[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11719] Merge 11715:11718 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11719] Merge 11715:11718 from trunk |
Date: |
Mon, 17 Feb 2014 20:29:50 +0000 |
Revision: 11719
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11719
Author: sigurdne
Date: 2014-02-17 20:29:49 +0000 (Mon, 17 Feb 2014)
Log Message:
-----------
Merge 11715:11718 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/catch/inc/custom/default/notify_by_email_18_1.php
branches/Version-1_0-branch/property/inc/export/default/Agresso_Bergen_Kostfordeling
Added Paths:
-----------
branches/Version-1_0-branch/catch/inc/custom/default/pdf_18_1.php
Property Changed:
----------------
branches/Version-1_0-branch/
Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
-
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,10570-10584,10586-10590,10592-10594,10596,10598-10599,10601-10611,10613,10615,10617-10626,10628-10636,10638,10640-10654,10656-10658,10660,10662-10672,10674,10676-10682,10684,10686,10688-10690,10692-10694,10696-10697,10699-10701,10703,10705-10706,10708-10724,10726-10731,10734,10736-10748,10750-10796,10798-10939,10941,10943,10945,10947-10953,10955,10957-10961,10963,10965-10966,10968-11001,11003-11030,11032-11034,11036,11038,11040,11042-11053,11055-11059,11061-11062,11064-11068,11070-11073,11075-11077,11079-11083,11085,11087-11088,11090-11093,11095-11108,11110-11111,11113,11115-11116,11118-11120,11122,11124-11129,11131-11132,11134,11136,11138,11140-11151,11153-11161,11163-11185,11187-11189,11191-11229,11231,11233,11235-11264,11266-11267,11269-11278,11280-11282,11284-11291,11293-11295,11297,11299-11302,11304,11306,11309,11311,11313-11316,11318-11323,11325-11332,11334,11336-11344,11346,11348-11354,11356,11358-11360,11363-11386,11388-11389,11391-11392,11394,11396-11403,11405-11406,11408,11410,11412,11415,11417,11419-11420,11422,11424-11429,11431-11442,11444-11445,11447-11460,11462-11464,11466-11470,11472-11475,11477-11478,11480-11487,11489-11492,11494,11496,11498,11500-11502,11504-11506,11508,11510-11511,11513,11515,11517-11523,11525-11526,11528-11531,11533,11535-11538,11540-11546,11548-11560,11563-11572,11574,11576,11578,11580-11581,11583,11585,11587,11589-11592,11594-11595,11597,11599,11601,11603,11605-11607,11609-11611,11613,11615-11619,11621-11622,11624-11630,11632,11634-11635,11637,11639-11640,11642,11644-11655,11657-11659,11661-11675,11677-11679,11681-11684,11686,11688,11690-11691,11693-11706,11708-11709,11711-11714
+
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,10570-10584,10586-10590,10592-10594,10596,10598-10599,10601-10611,10613,10615,10617-10626,10628-10636,10638,10640-10654,10656-10658,10660,10662-10672,10674,10676-10682,10684,10686,10688-10690,10692-10694,10696-10697,10699-10701,10703,10705-10706,10708-10724,10726-10731,10734,10736-10748,10750-10796,10798-10939,10941,10943,10945,10947-10953,10955,10957-10961,10963,10965-10966,10968-11001,11003-11030,11032-11034,11036,11038,11040,11042-11053,11055-11059,11061-11062,11064-11068,11070-11073,11075-11077,11079-11083,11085,11087-11088,11090-11093,11095-11108,11110-11111,11113,11115-11116,11118-11120,11122,11124-11129,11131-11132,11134,11136,11138,11140-11151,11153-11161,11163-11185,11187-11189,11191-11229,11231,11233,11235-11264,11266-11267,11269-11278,11280-11282,11284-11291,11293-11295,11297,11299-11302,11304,11306,11309,11311,11313-11316,11318-11323,11325-11332,11334,11336-11344,11346,11348-11354,11356,11358-11360,11363-11386,11388-11389,11391-11392,11394,11396-11403,11405-11406,11408,11410,11412,11415,11417,11419-11420,11422,11424-11429,11431-11442,11444-11445,11447-11460,11462-11464,11466-11470,11472-11475,11477-11478,11480-11487,11489-11492,11494,11496,11498,11500-11502,11504-11506,11508,11510-11511,11513,11515,11517-11523,11525-11526,11528-11531,11533,11535-11538,11540-11546,11548-11560,11563-11572,11574,11576,11578,11580-11581,11583,11585,11587,11589-11592,11594-11595,11597,11599,11601,11603,11605-11607,11609-11611,11613,11615-11619,11621-11622,11624-11630,11632,11634-11635,11637,11639-11640,11642,11644-11655,11657-11659,11661-11675,11677-11679,11681-11684,11686,11688,11690-11691,11693-11706,11708-11709,11711-11714,11716-11718
Modified:
branches/Version-1_0-branch/catch/inc/custom/default/notify_by_email_18_1.php
===================================================================
---
branches/Version-1_0-branch/catch/inc/custom/default/notify_by_email_18_1.php
2014-02-17 20:11:42 UTC (rev 11718)
+++
branches/Version-1_0-branch/catch/inc/custom/default/notify_by_email_18_1.php
2014-02-17 20:29:49 UTC (rev 11719)
@@ -99,53 +99,36 @@
$body = "<H2>Det er registrert ny post i
{$schema_text}</H2>";
}
- $jasper_id = isset($config_data['jasper_id']) &&
$config_data['jasper_id'] ? $config_data['jasper_id'] : 0;
-
$attachments = array();
- if(!$jasper_id)
+ require_once PHPGW_SERVER_ROOT .
"/catch/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/pdf_18_1.php";
+
+ $pdf = new pdf_18_1();
+
+ try
{
- $this->receipt['error'][] = array('msg' =>
lang('notify_by_email: missing "jasper_id" in config for catch %1 schema',
$schema_text));
+ $report = $pdf->get_document($id);
}
- else
+ catch(Exception $e)
{
- $jasper_parameters = '';
- $_parameters = array();
+ $error = $e->getMessage();
+ echo "<H1>{$error}</H1>";
+ }
- $_parameters[] = "ID|{$id}";
- $jasper_parameters = '"' . implode(';',
$_parameters) . '"';
- unset($_parameters);
+ $report_fname =
tempnam($GLOBALS['phpgw_info']['server']['temp_dir'], 'PDF_') . '.pdf';
+ file_put_contents($report_fname, $report, LOCK_EX);
- $output_type = 'PDF';
- $values_jasper =
execMethod('property.bojasper.read_single', $jasper_id);
- $report_source =
"{$GLOBALS['phpgw_info']['server']['files_dir']}/property/jasper/{$jasper_id}/{$values_jasper['file_name']}";
- $jasper_wrapper =
CreateObject('phpgwapi.jasper_wrapper');
+ $attachments[] = array
+ (
+ 'file' => $report_fname,
+ 'name' => "NLSH_melding_om_utflytting_{$id}.pdf",
+ 'type' => 'application/pdf'
+ );
- try
- {
- $report =
$jasper_wrapper->execute($jasper_parameters, $output_type, $report_source,
true);
- }
- catch(Exception $e)
- {
- $error = $e->getMessage();
- echo "<H1>{$error}</H1>";
- }
-
- $jasper_fname =
tempnam($GLOBALS['phpgw_info']['server']['temp_dir'], 'PDF_') . '.pdf';
- file_put_contents($jasper_fname, $report['content'],
LOCK_EX);
-
- $attachments[] = array
- (
- 'file' => $jasper_fname,
- 'name' => $report['filename'],
- 'type' => $report['mime']
- );
-
- if($attachments)
- {
- $body .= "</br>Rapport vedlagt";
- }
+ if($attachments)
+ {
+ $body .= "</br>Rapport vedlagt";
}
$this->db->query("SELECT kontraktsnummer, leie_opphore_fra_dato
FROM $target_table WHERE id = {$id}", __LINE__, __FILE__);
@@ -157,19 +140,17 @@
$this->db->query("SELECT id, num, utflyttingsdato FROM
fm_catch_3_1 WHERE kontraktsnummer = '{$_kontraktsnummer}'", __LINE__,
__FILE__);
if($this->db->next_record())
{
- $_num_3_1 = $this->db->f('num');
- $_id_3_1 = $this->db->f('id');
- $_old_utflyttingsdato =
$this->db->f('utflyttingsdato');
+ $_num_3_1 =
$this->db->f('num');
+ $_id_3_1 =
$this->db->f('id');
+ $_old_utflyttingsdato =
$this->db->f('utflyttingsdato');
$this->db->query("UPDATE fm_catch_3_1 SET
utflyttingsdato = '{$_utflyttingsdato}' WHERE id = '{$_id_3_1}'", __LINE__,
__FILE__);
$body .= "</br></br>Utflyttingsdato oppdatert
fra {$_old_utflyttingsdato} til {$_utflyttingsdato} for inneflyttemelding
{$_num_3_1}";
-
}
else
{
$body .= "</br></br>Fant ikke inneflyttemelding
for kontraktsnummer {$_kontraktsnummer}";
-
}
}
else
@@ -181,8 +162,8 @@
{
$this->receipt['message'][] = array('msg' => "email
notification sent to: {$_to}");
}
- if(isset($jasper_fname) && is_file($jasper_fname))
+ if(isset($report_fname) && is_file($report_fname))
{
- unlink($jasper_fname);
+ unlink($report_fname);
}
}
Copied: branches/Version-1_0-branch/catch/inc/custom/default/pdf_18_1.php (from
rev 11718, trunk/catch/inc/custom/default/pdf_18_1.php)
===================================================================
--- branches/Version-1_0-branch/catch/inc/custom/default/pdf_18_1.php
(rev 0)
+++ branches/Version-1_0-branch/catch/inc/custom/default/pdf_18_1.php
2014-02-17 20:29:49 UTC (rev 11719)
@@ -0,0 +1,231 @@
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software
Foundation, Inc. http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
+ * @package property
+ * @version $Id$
+ */
+
+ /**
+ * Custom class for catch_3_1
+ *
+ */
+
+ class pdf_18_1
+ {
+
+ var $preview = false;
+
+
+ public function __construct()
+ {
+
+
+ }
+
+
+ /**
+ * Produce the document for a specified record
+ * @param type $id
+ * @return string document
+ */
+ public function get_document($id = 0)
+ {
+ if(!$id)
+ {
+ return false;
+ }
+
+ $sql = "SELECT * FROM fm_catch_18_1 WHERE id ='{$id}'";
+ $GLOBALS['phpgw']->db->query($sql,__LINE__,__FILE__);
+ $GLOBALS['phpgw']->db->next_record();
+ $values = $GLOBALS['phpgw']->db->Record;
+
+//_debug_array($values);
+//die();
+
+ $config =
CreateObject('phpgwapi.config','property');
+
+ $config->read();
+
+ $pdf = CreateObject('phpgwapi.pdf');
+ $pdf -> ezSetMargins(50,70,50,50);
+ $pdf->selectFont(PHPGW_API_INC .
'/pdf/fonts/Helvetica.afm');
+
+ // put a line top and bottom on all the pages
+ $all = $pdf->openObject();
+ $pdf->saveState();
+
+
+ if(isset($config->config_data['order_logo']) &&
$config->config_data['order_logo'])
+ {
+
$pdf->addJpegFromFile($config->config_data['order_logo'],
+ 40,
+ 800,
+
isset($config->config_data['order_logo_width']) &&
$config->config_data['order_logo_width'] ?
$config->config_data['order_logo_width'] : 80
+ );
+ }
+
+ $pdf->setStrokeColor(0,0,0,1);
+ $pdf->line(20,40,578,40);
+ // $pdf->line(20,820,578,820);
+ // $pdf->addText(50,823,6,lang('order'));
+ $pdf->addText(50,28,6,$config->config_data['org_name']);
+ $pdf->addText(300,28,6,$date);
+
+ $pdf->restoreState();
+ $pdf->closeObject();
+ // note that object can be told to appear on just odd
or even pages by changing 'all' to 'odd'
+ // or 'even'.
+ $pdf->addObject($all,'all');
+
+ // $pdf->ezSetDy(-100);
+
+ $pdf->ezStartPageNumbers(500,28,6,'right','{PAGENUM} '
. lang('of') . ' {TOTALPAGENUM}',1);
+
+ $data = array
+ (
+ array
+ (
+
'col1'=>"{$config->config_data['org_name']}\n\nOrg.nr:
{$config->config_data['org_unit_id']}",
+ 'col2'=>'MELDING OM UTFLYTTING',
+ 'col3'=> 'Melding Nr:' . "\n\n{$id}"
+ )
+ );
+
+
$pdf->ezTable($data,array('col1'=>'','col2'=>'','col3'=>''),''
+ ,array('showHeadings'=>0,'shaded'=>0,'xPos'=>0
+ ,'xOrientation'=>'right','width'=>500
+ ,'cols'=>array
+ (
+
'col1'=>array('justification'=>'right','width'=>200, 'justification'=>'left'),
+
'col2'=>array('justification'=>'right','width'=>100, 'justification'=>'center'),
+
'col3'=>array('justification'=>'right','width'=>200),
+ )
+
+ ));
+
+ $pdf->ezText("Opphør av leieforhold, Kontrakt:
{$values['kontraktsnummer']}",14);
+ $pdf->ezSetDy(-20);
+
+ $address = 'Tildelt Leilighet:';
+ $address_element =
execMethod('property.botts.get_address_element', $values['location_code']);
+ foreach($address_element as $entry)
+ {
+ $address .= "\n {$entry['text']}:
{$entry['value']}";
+ }
+
+ $data = array
+ (
+ array
+ (
+ 'col1'=>"Leietaker:\n
{$values['navn_leietaker']}\n"
+ . "
Fødselsdato:{$values['foedselsdato']}\n"
+ . " Tlf:{$values['telefonnummer']}\n"
+ . " Avd:{$values['avdeling']}\n
Innbetaling av leie: {$values['innbetaling_av_leie']}\n"
+ . " Fakturaadresse:
{$values['fakturaadresse']}",
+ 'col2' => $address
+ ),
+ );
+
+ $pdf->ezTable($data,array('col1'=>'','col2'=>''),''
+ ,array('showHeadings'=>0,'shaded'=>0,'xPos'=>0
+
,'xOrientation'=>'right','width'=>500,'showLines'=> 0
+ ,'cols'=>array
+ (
+ 'col1' =>array('justification' =>
'right', 'width' => 250, 'justification' => 'left'),
+ 'col2' => array('justification' =>
'right', 'width' => 250, 'justification' => 'left'),
+ )
+
+ ));
+
+
+ $text = <<<TXT
+1. Boligen er inspisert av oppsynsmann ved NLSH dato:
{$values['boligen_inspisert_dato']}
+
+2. Nøkler til boligen er : "{$values['nokler_til_boligen_er']}"
Antall nøkler: {$values['antall_nokler']}
+
+3. Leien kan opphøre fra dato: {$values['leie_opphore_fra_dato']}
+
+4. Leietaker sier opp strøm ved utflytting.
+
+5. Målerstand ved utflytting: {$values['maalerstand_kwh']} Målernr:
{$values['maalernummer']}
+
+6. Leiligheten har mangler/feil iht innflyttingsprotokoll:
+ {$values['feil_mangler_innflytting']}
+
+7. Nye feil og mangler i perioden:
+ {$values['mangler_skader_leieperiode']}
+
+8. Er leietaker erstatningspliktig: {$values['leietaker_erstatningspliktig']}
+
+9. Erstatningspliktig beløp kr: {$values['erstatningspliktig_beloep']}
+10. Er det innbetalt forskudd: {$values['innbetalt_forskudd']}
+
+11. Innbetalt forskudd (kr) {$values['forskudd_beloep']}
+
+12. Forskudd tilbakebetales ? {$values['forskudd_tilbakebetales']}
+
+13. Merknader:
+{$values['merknader']}
+
+
+Dato:
+TXT;
+
+
+ $pdf->ezSetDy(-20);
+ $pdf->ezText($text,10);
+ $pdf->ezSetDy(-40);
+
+
+ $data = array
+ (
+ array('col1'=>"Sign
leietaker:\n\n\n{$values['navn_leietaker']}",'col2' =>
"Boligforvalter:\n\n\n{$values['boligforvalter']}"),
+ );
+
+ $pdf->ezTable($data,array('col1'=>'','col2'=>''),''
+ ,array('showHeadings'=>0,'shaded'=>0,'xPos'=>0
+
,'xOrientation'=>'right','width'=>500,'showLines'=> 0
+ ,'cols'=>array
+ (
+ 'col1' =>array('justification' =>
'right', 'width' => 250, 'justification' => 'left'),
+ 'col2' => array('justification' =>
'right', 'width' => 250, 'justification' => 'left'),
+ )
+
+ ));
+
+ $document= $pdf->ezOutput();
+
+ if($this->preview)
+ {
+
$pdf->print_pdf($document,"NLSH_melding_om_utflytting_{$id}");
+ }
+ else
+ {
+ return $document;
+ }
+
+ }
+
+ }
\ No newline at end of file
Modified:
branches/Version-1_0-branch/property/inc/export/default/Agresso_Bergen_Kostfordeling
===================================================================
---
branches/Version-1_0-branch/property/inc/export/default/Agresso_Bergen_Kostfordeling
2014-02-17 20:11:42 UTC (rev 11718)
+++
branches/Version-1_0-branch/property/inc/export/default/Agresso_Bergen_Kostfordeling
2014-02-17 20:29:49 UTC (rev 11719)
@@ -1,39 +1,39 @@
<?php
/**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C)
2003,2004,2005,2006,2007,2008,2009,2010,2011,2012 Free Software Foundation,
Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage export
- * @version $Id: Agresso 11369 2013-10-11 15:29:13Z sigurdne $
- */
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C)
2003,2004,2005,2006,2007,2008,2009,2010,2011,2012 Free Software Foundation,
Inc. http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
+ * @package property
+ * @subpackage export
+ * @version $Id: Agresso 11369 2013-10-11 15:29:13Z sigurdne $
+ */
/**
* Description
* @package property
*/
-
class export_conv
{
+
//var $fil_katalog='c:/temp'; //On windows use
"//computername/share/filename" or "\\\\computername\share\filename" to check
files on network shares.
protected $old_files_deleted;
@@ -46,29 +46,22 @@
function __construct()
{
- $this->db = & $GLOBALS['phpgw']->db;
- $this->join = & $this->db->join;
- $this->db2 = clone($this->db);
- $this->soXport = CreateObject('property.soXport');
- $this->config =
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id('property',
'.invoice'));
+ $this->db = & $GLOBALS['phpgw']->db;
+ $this->join = & $this->db->join;
+ $this->db2 = clone($this->db);
+ $this->soXport = CreateObject('property.soXport');
+ $this->config = CreateObject('admin.soconfig',
$GLOBALS['phpgw']->locations->get_id('property', '.invoice'));
}
- function
select_periods_with_invoice_to_transfer($pre_transfer='')
+ function select_periods_with_invoice_to_transfer()
{
- if($pre_transfer)
- {
- $sql= "SELECT DISTINCT periode from fm_ecobilag
WHERE utbetalingsigndato IS NULL";
- }
- else
- {
- $sql= "SELECT DISTINCT periode from fm_ecobilag
WHERE budsjettsigndato is not null and (saksigndato is not null or
oppsynsigndato is not null) and utbetalingsigndato is not null";
- }
+ $sql = "SELECT DISTINCT periode from fm_ecobilag WHERE
budsjettsigndato is not null and (saksigndato is not null or oppsynsigndato is
not null) and utbetalingsigndato is not null";
$periode = array();
- $this->db->query($sql,__LINE__,__FILE__);
- while ($this->db->next_record())
+ $this->db->query($sql, __LINE__, __FILE__);
+ while($this->db->next_record())
{
- $periode[] = $this->db->f('periode');
+ $periode[] = $this->db->f('periode');
}
return $periode;
@@ -76,35 +69,34 @@
function log_end($batchid)
{
- $tid=date($this->soXport->datetimeformat);
- $sql= "insert into fm_ecologg (batchid,melding,tid)
values ('$batchid','End transfer','$tid')";
- $this->db->query($sql,__LINE__,__FILE__);
- }
+ $tid = date($this->soXport->datetimeformat);
+ $sql = "insert into fm_ecologg (batchid,melding,tid)
values ('$batchid','End transfer','$tid')";
+ $this->db->query($sql, __LINE__, __FILE__);
+ }
- function log_error($batchid,$error_desr)
+ function log_error($batchid, $error_desr)
{
- $tid=date($this->soXport->datetimeformat);
- $sql= "insert into fm_ecologg
(batchid,ecobilagid,status,melding,tid) values
('$batchid',NULL,0,'$error_desr','$tid')";
- $this->db->query($sql,__LINE__,__FILE__);
- }
+ $tid = date($this->soXport->datetimeformat);
+ $sql = "insert into fm_ecologg
(batchid,ecobilagid,status,melding,tid) values
('$batchid',NULL,0,'$error_desr','$tid')";
+ $this->db->query($sql, __LINE__, __FILE__);
+ }
function increment_batchid()
{
- $this->db->query("update fm_idgenerator set value =
value + 1 where name = 'Ecobatchid'",__LINE__,__FILE__);
- $this->db->query("select value from fm_idgenerator
where name = 'Ecobatchid'",__LINE__,__FILE__);
+ $this->db->query("update fm_idgenerator set value =
value + 1 where name = 'Ecobatchid'", __LINE__, __FILE__);
+ $this->db->query("select value from fm_idgenerator
where name = 'Ecobatchid'", __LINE__, __FILE__);
$this->db->next_record();
$bilagsnr = $this->db->f('value');
return $bilagsnr;
-
}
function next_batchid()
{
- $this->db->query("select value from fm_idgenerator
where name = 'Ecobatchid'",__LINE__,__FILE__);
+ $this->db->query("select value from fm_idgenerator
where name = 'Ecobatchid'", __LINE__, __FILE__);
$this->db->next_record();
- $batchid = $this->db->f('value')+1;
+ $batchid = $this->db->f('value') + 1;
return $batchid;
}
@@ -112,42 +104,42 @@
//Lagre start melding
function log_start($batchid)
{
- $tid=date($this->soXport->datetimeformat);
- $sql= "insert into fm_ecologg (batchid,melding,tid)
values ('$batchid','Start transfer','$tid')";
- $this->db->query($sql,__LINE__,__FILE__);
- }
+ $tid = date($this->soXport->datetimeformat);
+ $sql = "insert into fm_ecologg (batchid,melding,tid)
values ('$batchid','Start transfer','$tid')";
+ $this->db->query($sql, __LINE__, __FILE__);
+ }
- function get_vendor_info($vendor_id='')
+ function get_vendor_info($vendor_id = '')
{
$sql = "select org_nr,konto_nr from fm_vendor where
id='$vendor_id'";
- $this->db->query($sql,__LINE__,__FILE__);
+ $this->db->query($sql, __LINE__, __FILE__);
$this->db->next_record();
- $vendor_info= array(
- 'org_nr' => $this->db->f('org_nr'),
- 'konto_nr' => $this->db->f('konto_nr')
- );
+ $vendor_info = array(
+ 'org_nr' => $this->db->f('org_nr'),
+ 'konto_nr' => $this->db->f('konto_nr')
+ );
return $vendor_info;
}
- function get_order_title($order_id='')
+ function get_order_title($order_id = '')
{
$sql = "select type from fm_orders where
id='$order_id'";
- $this->db->query($sql,__LINE__,__FILE__);
+ $this->db->query($sql, __LINE__, __FILE__);
$this->db->next_record();
switch($this->db->f('type'))
{
case 'workorder':
- $sql2 = "select title from fm_workorder
where id='$order_id'";
-
$this->db->query($sql2,__LINE__,__FILE__);
+ $sql2 = "select title from
fm_workorder where id='$order_id'";
+ $this->db->query($sql2, __LINE__,
__FILE__);
$this->db->next_record();
$order_title = $this->db->f('title');
break;
case 's_agreement':
- $sql2 = "select descr as title from
fm_s_agreement where id='$order_id'";
-
$this->db->query($sql2,__LINE__,__FILE__);
+ $sql2 = "select descr as
title from fm_s_agreement where id='$order_id'";
+ $this->db->query($sql2, __LINE__,
__FILE__);
$this->db->next_record();
$order_title = $this->db->f('title');
break;
@@ -156,99 +148,98 @@
return $order_title;
}
-
- function select_invoice_rollback($day,$month,$year,$Filnavn)
+ function select_invoice_rollback($day, $month, $year, $Filnavn)
{
switch($GLOBALS['phpgw_info']['server']['db_type'])
{
case 'mssql':
- $datepart_year =
"datepart(year,overftid)";
- $datepart_month =
"datepart(month,overftid)";
- $datepart_day =
"datepart(day,overftid)";
+ $datepart_year =
"datepart(year,overftid)";
+ $datepart_month =
"datepart(month,overftid)";
+ $datepart_day =
"datepart(day,overftid)";
break;
case 'mysql':
- $datepart_year =
"YEAR(overftid)";
- $datepart_month =
"MONTH(overftid)";
- $datepart_day =
"DAYOFMONTH(overftid)";
+ $datepart_year = "YEAR(overftid)";
+ $datepart_month = "MONTH(overftid)";
+ $datepart_day =
"DAYOFMONTH(overftid)";
break;
case 'pgsql':
case 'postgres':
- $datepart_year =
"date_part('year',overftid)";
- $datepart_month =
"date_part('month',overftid)";
- $datepart_day =
"date_part('day',overftid)";
+ $datepart_year =
"date_part('year',overftid)";
+ $datepart_month =
"date_part('month',overftid)";
+ $datepart_day =
"date_part('day',overftid)";
break;
}
- $sql = "SELECT * FROM fm_ecobilagoverf WHERE filnavn='$Filnavn'
and $datepart_year=$year and $datepart_month=$month and $datepart_day= $day";
- $this->db->query($sql,__LINE__,__FILE__);
+ $sql = "SELECT * FROM fm_ecobilagoverf WHERE
filnavn='$Filnavn' and $datepart_year=$year and $datepart_month=$month and
$datepart_day= $day";
+ $this->db->query($sql, __LINE__, __FILE__);
$i = 0;
- while ($this->db->next_record())
+ while($this->db->next_record())
{
- $invoice_roleback[$i]['id'] =
$this->db->f('id');
- $invoice_roleback[$i]['bilagsnr'] =
$this->db->f('bilagsnr');
- $invoice_roleback[$i]['kidnr'] =
$this->db->f('kidnr');
- $invoice_roleback[$i]['typeid'] =
$this->db->f('typeid');
- $invoice_roleback[$i]['kildeid'] =
$this->db->f('kildeid');
- $invoice_roleback[$i]['pmwrkord_code'] =
$this->db->f('pmwrkord_code');
- $invoice_roleback[$i]['belop'] =
$this->db->f('belop');
- $invoice_roleback[$i]['fakturadato'] =
$this->db->f('fakturadato');
- $invoice_roleback[$i]['periode'] =
$this->db->f('periode');
- $invoice_roleback[$i]['forfallsdato'] =
$this->db->f('forfallsdato');
- $invoice_roleback[$i]['fakturanr'] =
$this->db->f('fakturanr');
- $invoice_roleback[$i]['spbudact_code'] =
$this->db->f('spbudact_code');
- $invoice_roleback[$i]['regtid'] =
$this->db->f('regtid');
- $invoice_roleback[$i]['artid'] =
$this->db->f('artid');
- $invoice_roleback[$i]['godkjentbelop'] =
$this->db->f('godkjentbelop');
- $invoice_roleback[$i]['spvend_code'] =
$this->db->f('spvend_code');
- $invoice_roleback[$i]['dima'] =
$this->db->f('dima');
- $invoice_roleback[$i]['loc1'] =
$this->db->f('loc1');
- $invoice_roleback[$i]['dimb'] =
$this->db->f('dimb');
- $invoice_roleback[$i]['mvakode'] =
$this->db->f('mvakode');
- $invoice_roleback[$i]['dimd'] =
$this->db->f('dimd');
- $invoice_roleback[$i]['project_id'] =
$this->db->f('project_id');
- $invoice_roleback[$i]['kostra_id'] =
$this->db->f('kostra_id');
- $invoice_roleback[$i]['item_type'] =
$this->db->f('item_type');
- $invoice_roleback[$i]['item_id'] =
$this->db->f('item_id');
+ $invoice_roleback[$i]['id']
= $this->db->f('id');
+ $invoice_roleback[$i]['bilagsnr']
= $this->db->f('bilagsnr');
+ $invoice_roleback[$i]['kidnr']
= $this->db->f('kidnr');
+ $invoice_roleback[$i]['typeid']
= $this->db->f('typeid');
+ $invoice_roleback[$i]['kildeid']
= $this->db->f('kildeid');
+ $invoice_roleback[$i]['pmwrkord_code'] =
$this->db->f('pmwrkord_code');
+ $invoice_roleback[$i]['belop']
= $this->db->f('belop');
+ $invoice_roleback[$i]['fakturadato'] =
$this->db->f('fakturadato');
+ $invoice_roleback[$i]['periode']
= $this->db->f('periode');
+ $invoice_roleback[$i]['forfallsdato'] =
$this->db->f('forfallsdato');
+ $invoice_roleback[$i]['fakturanr']
= $this->db->f('fakturanr');
+ $invoice_roleback[$i]['spbudact_code'] =
$this->db->f('spbudact_code');
+ $invoice_roleback[$i]['regtid']
= $this->db->f('regtid');
+ $invoice_roleback[$i]['artid']
= $this->db->f('artid');
+ $invoice_roleback[$i]['godkjentbelop'] =
$this->db->f('godkjentbelop');
+ $invoice_roleback[$i]['spvend_code'] =
$this->db->f('spvend_code');
+ $invoice_roleback[$i]['dima']
= $this->db->f('dima');
+ $invoice_roleback[$i]['loc1']
= $this->db->f('loc1');
+ $invoice_roleback[$i]['dimb']
= $this->db->f('dimb');
+ $invoice_roleback[$i]['mvakode']
= $this->db->f('mvakode');
+ $invoice_roleback[$i]['dimd']
= $this->db->f('dimd');
+ $invoice_roleback[$i]['project_id']
= $this->db->f('project_id');
+ $invoice_roleback[$i]['kostra_id']
= $this->db->f('kostra_id');
+ $invoice_roleback[$i]['item_type']
= $this->db->f('item_type');
+ $invoice_roleback[$i]['item_id']
= $this->db->f('item_id');
if($this->db->f('oppsynsmannid'))
{
- $invoice_roleback[$i]['oppsynsmannid']
= $this->db->f('oppsynsmannid');
+ $invoice_roleback[$i]['oppsynsmannid']
= $this->db->f('oppsynsmannid');
}
if($this->db->f('saksbehandlerid'))
{
-
$invoice_roleback[$i]['saksbehandlerid'] =
$this->db->f('saksbehandlerid');
+
$invoice_roleback[$i]['saksbehandlerid'] = $this->db->f('saksbehandlerid');
}
- $invoice_roleback[$i]['budsjettansvarligid']
= $this->db->f('budsjettansvarligid');
+ $invoice_roleback[$i]['budsjettansvarligid'] =
$this->db->f('budsjettansvarligid');
if($this->db->f('oppsynsigndato'))
{
- $invoice_roleback[$i]['oppsynsigndato']
= $this->db->f('oppsynsigndato');
+ $invoice_roleback[$i]['oppsynsigndato']
= $this->db->f('oppsynsigndato');
}
if($this->db->f('saksigndato'))
{
- $invoice_roleback[$i]['saksigndato']
= $this->db->f('saksigndato');
+ $invoice_roleback[$i]['saksigndato'] =
$this->db->f('saksigndato');
}
- $invoice_roleback[$i]['budsjettsigndato']
= $this->db->f('budsjettsigndato');
- $invoice_roleback[$i]['merknad'] =
$this->db->f('merknad');
- $invoice_roleback[$i]['splitt'] =
$this->db->f('splitt');
- $invoice_roleback[$i]['ordrebelop'] =
$this->db->f('ordrebelop');
- $invoice_roleback[$i]['utbetalingid'] =
$this->db->f('utbetalingid');
- $invoice_roleback[$i]['utbetalingsigndato']
= $this->db->f('utbetalingsigndato');
+ $invoice_roleback[$i]['budsjettsigndato']
= $this->db->f('budsjettsigndato');
+ $invoice_roleback[$i]['merknad']
= $this->db->f('merknad');
+ $invoice_roleback[$i]['splitt']
= $this->db->f('splitt');
+ $invoice_roleback[$i]['ordrebelop']
= $this->db->f('ordrebelop');
+ $invoice_roleback[$i]['utbetalingid']
= $this->db->f('utbetalingid');
+ $invoice_roleback[$i]['utbetalingsigndato']
= $this->db->f('utbetalingsigndato');
$i++;
}
return $invoice_roleback;
- }
+ }
-
//rollback function
function bilag_update_overf($BilagOverf)
{
- $values= array(
+ $values = array
+ (
$BilagOverf['project_id'],
$BilagOverf['kostra_id'],
$BilagOverf['pmwrkord_code'],
@@ -281,11 +272,11 @@
$BilagOverf['utbetalingsigndato'],
$BilagOverf['item_type'],
$BilagOverf['item_id'],
- );
+ );
- $values = $this->db->validate_insert($values);
+ $values = $this->db->validate_insert($values);
- $sql= "INSERT INTO fm_ecobilag
(project_id,kostra_id,pmwrkord_code,bilagsnr,splitt,kildeid,kidnr,typeid,"
+ $sql = "INSERT INTO fm_ecobilag
(project_id,kostra_id,pmwrkord_code,bilagsnr,splitt,kildeid,kidnr,typeid,"
. "
fakturadato,forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,"
. "
saksbehandlerid,budsjettansvarligid,fakturanr,spbudact_code,dima,loc1,dimd,mvakode,"
. "
periode,merknad,utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,utbetalingsigndato,item_type,item_id,belop,godkjentbelop)"
@@ -293,106 +284,91 @@
. $this->db->money_format($BilagOverf['belop']) . ","
. $this->db->money_format($BilagOverf['godkjentbelop'])
. ")";
- $this->db->query($sql,__LINE__,__FILE__);
+ $this->db->query($sql, __LINE__, __FILE__);
}
- function
overfor($download,$pre_transfer='',$force_period_year='')
+ function overfor($download, $pre_transfer = '',
$force_period_year = '')
{
// $download = 'on';
// $download = False;
- $pre_transfer=false;
// $this->debug=True;
-
//Generer batch ID
$batchid = $this->soXport->next_batchid();
- if ($download=='on')
+ if($download == 'on')
{
$this->increment_batchid();
//Lagre melding
$this->log_start($batchid);
}
- //Velg ut alle perioder som har bilag som skal overføres
- if ($pre_transfer)
- {
- $periodes =
$this->select_periods_with_invoice_to_transfer($pre_transfer);
- foreach ($periodes as $periode)
- {
-
$this->OverforPeriode($batchid,$periode,$download,$pre_transfer);
- }
- }
+ $periodes =
$this->select_periods_with_invoice_to_transfer();
- $pre_transfer=False;
-
- $periodes =
$this->select_periods_with_invoice_to_transfer($pre_transfer);
-
- foreach ($periodes as $periode)
+ foreach($periodes as $periode)
{
-
$this->OverforPeriode($batchid,$periode,$download,$pre_transfer,$force_period_year);
+ $this->OverforPeriode($batchid, $periode,
$download, $force_period_year);
}
//Lagre melding
- if ($download=='on' || $pre_transfer)
+ if($download == 'on')
{
$this->log_end($batchid); //Lagre melding
}
- if (!$download=='on')
+ if(!$download == 'on')
{
- $GLOBALS['phpgw_info']['flags']['noheader'] =
true;
- $GLOBALS['phpgw_info']['flags']['nofooter'] =
true;
- $GLOBALS['phpgw_info']['flags']['xslt_app'] =
false;
- $GLOBALS['phpgw_info']['flags']['noframework']
= true;
- echo ' <a
href="'.$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiXport.export')) . '">' . lang('Back') . '</a></br>';
+ $GLOBALS['phpgw_info']['flags']['noheader']
= true;
+ $GLOBALS['phpgw_info']['flags']['nofooter']
= true;
+ $GLOBALS['phpgw_info']['flags']['xslt_app']
= false;
+ $GLOBALS['phpgw_info']['flags']['noframework']
= true;
+ echo ' <a href="' .
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiXport.export')) . '">' . lang('Back') . '</a></br>';
$GLOBALS['phpgw']->common->phpgw_exit();
}
return $receipt;
}
- function errorhandler($batchid,$error_desr)
+ function errorhandler($batchid, $error_desr)
{
$this->db->transaction_abort();
$meld = $error_desr;
- phpgwapi_cache::message_set($error_desr, 'error');
+ phpgwapi_cache::message_set($error_desr, 'error');
//Vis feilmelding
// echo $meld;
-
//Lagre feilmelding
- $this->log_error($batchid,$error_desr);
+ $this->log_error($batchid, $error_desr);
}
- function RullTilbake($Filnavn,$Dato)
+ function RullTilbake($Filnavn, $Dato)
{
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $dateformat = str_replace(".","",$dateformat);
- $dateformat = str_replace("-","",$dateformat);
- $dateformat = str_replace("/","",$dateformat);
- $y=strpos($dateformat,'y');
- $d=strpos($dateformat,'d');
- $m=strpos($dateformat,'m');
+ $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $dateformat = str_replace(".", "", $dateformat);
+ $dateformat = str_replace("-", "", $dateformat);
+ $dateformat = str_replace("/", "", $dateformat);
+ $y = strpos($dateformat, 'y');
+ $d = strpos($dateformat, 'd');
+ $m = strpos($dateformat, 'm');
- $dateparts = explode('/', $Dato);
- $day = $dateparts[$d];
- $month = $dateparts[$m];
- $year = $dateparts[$y];
- /* $date1 = mktime (2,0,0,$month,$day,$year);
- if ($date1)
- {
- $Dato=$date1;
- }
+ $dateparts = explode('/', $Dato);
+ $day = $dateparts[$d];
+ $month = $dateparts[$m];
+ $year = $dateparts[$y];
+ /* $date1 = mktime
(2,0,0,$month,$day,$year);
+ if ($date1)
+ {
+ $Dato=$date1;
+ }
- $Dato= date("M d Y",$Dato);
- */
+ $Dato= date("M d Y",$Dato);
+ */
-
$BilagOverf=$this->select_invoice_rollback($day,$month,$year,$Filnavn);
+ $BilagOverf = $this->select_invoice_rollback($day,
$month, $year, $Filnavn);
$this->db->transaction_begin();
- for ($i=0;$i<count($BilagOverf);$i++)
+ for($i = 0; $i < count($BilagOverf); $i++)
{
$this->bilag_update_overf($BilagOverf[$i]);
@@ -401,25 +377,24 @@
{
$orders_affected[$BilagOverf[$i]['pmwrkord_code']] = true;
- $Belop = sprintf("%01.2f",
$BilagOverf[$i]['ordrebelop'])*100;
+ $Belop = sprintf("%01.2f",
$BilagOverf[$i]['ordrebelop']) * 100;
- if ($BilagOverf[$i]['dimd'] % 2 == 0)
+ if($BilagOverf[$i]['dimd'] % 2 == 0)
{
-
$actual_cost_field='act_mtrl_cost';
+ $actual_cost_field =
'act_mtrl_cost';
}
else
{
-
$actual_cost_field='act_vendor_cost';
+ $actual_cost_field =
'act_vendor_cost';
}
- $operator='-';
+ $operator = '-';
-
$this->soXport->correct_actual_cost($BilagOverf[$i]['pmwrkord_code'],$Belop,$actual_cost_field,$operator);
+
$this->soXport->correct_actual_cost($BilagOverf[$i]['pmwrkord_code'], $Belop,
$actual_cost_field, $operator);
}
//Slett fra avviks tabell
- //
$this->soXport->delete_avvik($BilagOverf[$i]['bilagsnr']);
-
+ //
$this->soXport->delete_avvik($BilagOverf[$i]['bilagsnr']);
//Slett fra arkiv
$this->soXport->delete_invoice($BilagOverf[$i]['bilagsnr']);
@@ -430,159 +405,111 @@
{
$fil_katalog =
$this->config->config_data['export']['path'];
- if(unlink ($fil_katalog. '/' . $Filnavn))
+ if(unlink($fil_katalog . '/' . $Filnavn))
{
$this->db->transaction_commit();
- $receipt['message'][]= array('msg' =>
$antall . ' ' . lang('bilag/underbilag rullet tilbake'));
- $receipt['message'][]= array('msg' =>
lang('File %1 is deleted',$Filnavn));
+ $receipt['message'][] = array('msg'
=> $antall . ' ' . lang('bilag/underbilag rullet tilbake'));
+ $receipt['message'][] = array('msg'
=> lang('File %1 is deleted', $Filnavn));
}
else
{
$this->db->transaction_abort();
- $receipt['message'][]= array('msg' =>
'Noe gikk galt!');
+ $receipt['message'][] = array('msg' =>
'Noe gikk galt!');
}
}
else
{
- $receipt['error'][]= array('msg' => lang('Sorry
- None hits'));
+ $receipt['error'][] = array('msg' =>
lang('Sorry - None hits'));
}
return $receipt;
}
-
- function LagFilnavn ($batchid,$pre_transfer='')
+ function LagFilnavn($batchid)
{
- if($pre_transfer)
+ $fil_katalog =
$this->config->config_data['export']['path'];
+ $continue = True;
+ $i = 1;
+ do
{
- $fil_katalog =
$this->config->config_data['export']['pre_path'];
+ $Filnavn = $fil_katalog . '/FDB' . date("dmy")
. '_' . sprintf("%02s", $i) . '.TXT';
- // Slett gamle filer
-
- if(!$this->old_files_deleted)
+ //Sjekk om filen eksisterer
+ If(!file_exists($Filnavn))
{
- for ($i=0;$i<13;$i++)
- {
- @unlink($fil_katalog . '/FDA_'
. $i. '.TXT');
- }
-
- $this->old_files_deleted= True;
+ return $Filnavn;
}
-
- $i = 1;
- do
- {
- $Filnavn = $fil_katalog . '/FDA_' . $i.
'.TXT';
-
- //Sjekk om filen eksisterer
- If (!file_exists($Filnavn))
- {
- return $Filnavn;
- }
-
- $i++;
- }
- while ($i < 13);
-
+ $i++;
}
- else
- {
- $fil_katalog =
$this->config->config_data['export']['path'];
- $continue = True;
- $i = 1;
- do
- {
- $Filnavn = $fil_katalog . '/FDB' .
date("dmy") . '_' . sprintf("%02s",$i) . '.TXT';
+ while($continue);
- //Sjekk om filen eksisterer
- If (!file_exists($Filnavn))
- {
- return $Filnavn;
- }
-
- $i++;
- }
- while ($continue);
- }
-
-
//Ingen løpenr er ledige, gi feilmelding
return False;
}
-
- private function
get_vouchers_to_transfer($periode,$pre_transfer=false)
+ private function get_vouchers_to_transfer($periode)
{
- if($pre_transfer)
- {
- $sql= "SELECT sum(belop) as belop, fakturanr,
bilagsnr FROM fm_ecobilag WHERE periode='{$periode}' AND utbetalingsigndato IS
NULL GROUP BY bilagsnr, fakturanr";
- }
- else
- {
- $sql="SELECT sum(belop) as belop, fakturanr,
bilagsnr FROM fm_ecobilag WHERE periode='{$periode}' AND budsjettsigndato IS
NOT NULL AND ( saksigndato IS NOT NULL OR oppsynsigndato IS NOT NULL ) AND
utbetalingsigndato IS NOT NULL group by bilagsnr, fakturanr";
- }
+ $sql = "SELECT sum(belop) as belop, fakturanr, bilagsnr
FROM fm_ecobilag WHERE periode='{$periode}' AND budsjettsigndato IS NOT NULL
AND ( saksigndato IS NOT NULL OR oppsynsigndato IS NOT NULL ) AND
utbetalingsigndato IS NOT NULL group by bilagsnr, fakturanr";
- $this->db->query($sql,__LINE__,__FILE__);
+ $this->db->query($sql, __LINE__, __FILE__);
$values = array();
- while ($this->db->next_record())
+ while($this->db->next_record())
{
$values[] = array
- (
- 'belop' =>
$this->db->f('belop'),
- 'bilagsnr' =>
$this->db->f('bilagsnr'),
- 'fakturanr' =>
$this->db->f('fakturanr'),
+ (
+ 'belop' =>
$this->db->f('belop'),
+ 'bilagsnr' =>
$this->db->f('bilagsnr'),
+ 'fakturanr' =>
$this->db->f('fakturanr'),
);
}
- foreach ($values as &$entry)
+ foreach($values as &$entry)
{
- $sql= "SELECT fm_ecobilag.*,fm_ecouser.initials
as saksbehandler FROM fm_ecobilag {$this->join} fm_ecouser ON
fm_ecobilag.budsjettansvarligid=fm_ecouser.lid"
+ $sql = "SELECT
fm_ecobilag.*,fm_ecouser.initials as saksbehandler FROM fm_ecobilag
{$this->join} fm_ecouser ON fm_ecobilag.budsjettansvarligid=fm_ecouser.lid"
. " WHERE bilagsnr='{$entry['bilagsnr']}' AND
fakturanr = '{$entry['fakturanr']}'";
- $this->db->query($sql,__LINE__,__FILE__);
+ $this->db->query($sql, __LINE__, __FILE__);
$this->db->next_record();
- $entry['id']
= $this->db->f('id');
- $entry['kidnr']
= $this->db->f('kidnr');
- $entry['typeid']
= $this->db->f('typeid');
- $entry['kildeid']
= $this->db->f('kildeid');
- $entry['pmwrkord_code'] =
$this->db->f('pmwrkord_code');
- $entry['fakturadato'] =
$this->db->f('fakturadato');
- $entry['periode']
= $this->db->f('periode');
- $entry['forfallsdato'] =
$this->db->f('forfallsdato');
- $entry['fakturanr']
= $this->db->f('fakturanr');
- $entry['spbudact_code'] =
$this->db->f('spbudact_code');
- $entry['regtid']
= $this->db->f('regtid');
- $entry['artid']
= $this->db->f('artid');
- $entry['godkjentbelop'] =
$entry['belop'];
- $entry['spvend_code'] =
$this->db->f('spvend_code');
- $entry['dima']
= $this->db->f('dima');
- $entry['dimb']
= $this->db->f('dimb');
- $entry['mvakode']
= $this->db->f('mvakode');
- $entry['dimd']
= $this->db->f('dimd');
- $entry['dime']
= $this->db->f('dime');
- $entry['oppsynsmannid'] =
$this->db->f('oppsynsmannid');
- $entry['saksbehandlerid'] =
$this->db->f('saksbehandlerid');
- $entry['budsjettansvarligid'] =
$this->db->f('budsjettansvarligid');
- $entry['oppsynsigndato'] =
$this->db->f('oppsynsigndato');
- $entry['saksigndato'] =
$this->db->f('saksigndato');
- $entry['budsjettsigndato'] =
$this->db->f('budsjettsigndato');
- $entry['merknad']
= $this->db->f('merknad');
- $entry['line_text']
= $this->db->f('line_text');
- $entry['splitt']
= $this->db->f('splitt');
- $entry['utbetalingid'] =
$this->db->f('utbetalingid');
- $entry['utbetalingsigndato'] =
$this->db->f('utbetalingsigndato');
- $entry['saksbehandler'] =
$this->db->f('saksbehandler');
- $entry['invoice_line']
= $this->get_invoice($entry['bilagsnr'], $entry['fakturanr']);
-
+ $entry['id']
= $this->db->f('id');
+ $entry['kidnr']
= $this->db->f('kidnr');
+ $entry['typeid']
= $this->db->f('typeid');
+ $entry['kildeid']
= $this->db->f('kildeid');
+ $entry['pmwrkord_code'] =
$this->db->f('pmwrkord_code');
+ $entry['fakturadato'] =
$this->db->f('fakturadato');
+ $entry['periode']
= $this->db->f('periode');
+ $entry['forfallsdato'] =
$this->db->f('forfallsdato');
+ $entry['fakturanr']
= $this->db->f('fakturanr');
+ $entry['spbudact_code'] =
$this->db->f('spbudact_code');
+ $entry['regtid']
= $this->db->f('regtid');
+ $entry['artid']
= $this->db->f('artid');
+ $entry['godkjentbelop'] =
$entry['belop'];
+ $entry['spvend_code'] =
$this->db->f('spvend_code');
+ $entry['dima']
= $this->db->f('dima');
+ $entry['dimb']
= $this->db->f('dimb');
+ $entry['mvakode']
= $this->db->f('mvakode');
+ $entry['dimd']
= $this->db->f('dimd');
+ $entry['dime']
= $this->db->f('dime');
+ $entry['oppsynsmannid'] =
$this->db->f('oppsynsmannid');
+ $entry['saksbehandlerid'] =
$this->db->f('saksbehandlerid');
+ $entry['budsjettansvarligid'] =
$this->db->f('budsjettansvarligid');
+ $entry['oppsynsigndato'] =
$this->db->f('oppsynsigndato');
+ $entry['saksigndato'] =
$this->db->f('saksigndato');
+ $entry['budsjettsigndato'] =
$this->db->f('budsjettsigndato');
+ $entry['merknad']
= $this->db->f('merknad');
+ $entry['line_text']
= $this->db->f('line_text');
+ $entry['splitt']
= $this->db->f('splitt');
+ $entry['utbetalingid'] =
$this->db->f('utbetalingid');
+ $entry['utbetalingsigndato'] =
$this->db->f('utbetalingsigndato');
+ $entry['saksbehandler'] =
$this->db->f('saksbehandler');
+ $entry['invoice_line'] =
$this->get_invoice($entry['bilagsnr'], $entry['fakturanr']);
}
return $values;
}
-
//Velg ut alle underbilag
private function get_invoice($bilagsnr, $fakturanr)
@@ -592,88 +519,86 @@
throw new Exception('Mangler fakturanr');
}
- $sql= "SELECT fm_ecobilag.*
,fm_part_of_town.district_id"
+ $sql = "SELECT fm_ecobilag.*
,fm_part_of_town.district_id"
. " FROM (fm_location1 {$this->join} fm_part_of_town ON
fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id)"
. " {$this->join} fm_ecobilag ON fm_location1.loc1 =
fm_ecobilag.loc1"
. " WHERE bilagsnr='$bilagsnr' AND fakturanr =
'{$fakturanr}'";
- $this->db2->query($sql,__LINE__,__FILE__);
+ $this->db2->query($sql, __LINE__, __FILE__);
$values = array();
- while ($this->db2->next_record())
+ while($this->db2->next_record())
{
$values[] = array
- (
- 'id'
=> $this->db2->f('id'),
- 'bilagsnr'
=> $this->db2->f('bilagsnr'),
- 'kidnr'
=> $this->db2->f('kidnr'),
- 'typeid'
=> $this->db2->f('typeid'),
- 'kildeid'
=> $this->db2->f('kildeid'),
- 'pmwrkord_code' =>
$this->db2->f('pmwrkord_code'),
- 'belop'
=> $this->db2->f('belop'),
- 'fakturadato' =>
$this->db2->f('fakturadato'),
- 'periode'
=> $this->db2->f('periode'),
- 'forfallsdato' =>
$this->db2->f('forfallsdato'),
- 'fakturanr'
=> $this->db2->f('fakturanr'),
- 'spbudact_code' =>
$this->db2->f('spbudact_code'),
- 'regtid'
=> $this->db2->f('regtid'),
- 'artid'
=> $this->db2->f('artid'),
- 'godkjentbelop' =>
$this->db2->f('godkjentbelop'),
- 'spvend_code' =>
$this->db2->f('spvend_code'),
- 'dima'
=> $this->db2->f('dima'),
- 'loc1'
=> $this->db2->f('loc1'),
- 'dimb'
=> $this->db2->f('dimb'),
- 'mvakode'
=> $this->db2->f('mvakode'),
- 'dimd'
=> $this->db2->f('dimd'),
- 'dime'
=> $this->db2->f('dime'),
- 'project_id' =>
$this->db2->f('project_id'),
- 'kostra_id'
=> $this->db2->f('kostra_id'),
- 'oppsynsmannid' =>
$this->db2->f('oppsynsmannid'),
- 'saksbehandlerid' =>
$this->db2->f('saksbehandlerid'),
- 'budsjettansvarligid' =>
$this->db2->f('budsjettansvarligid'),
- 'oppsynsigndato' =>
$this->db2->f('oppsynsigndato'),
- 'saksigndato' =>
$this->db2->f('saksigndato'),
- 'budsjettsigndato' =>
$this->db2->f('budsjettsigndato'),
- 'merknad'
=> $this->db2->f('merknad'),
- 'line_text'
=> $this->db2->f('line_text'),
- 'splitt'
=> $this->db2->f('splitt'),
- 'utbetalingid' =>
$this->db2->f('utbetalingid'),
- 'utbetalingsigndato' =>
$this->db2->f('utbetalingsigndato'),
- 'district_id' =>
$this->db2->f('district_id'),
- 'item_type'
=> $this->db2->f('item_type'),
- 'item_id'
=> $this->db2->f('item_id')
+ (
+ 'id'
=> $this->db2->f('id'),
+ 'bilagsnr'
=> $this->db2->f('bilagsnr'),
+ 'kidnr'
=> $this->db2->f('kidnr'),
+ 'typeid'
=> $this->db2->f('typeid'),
+ 'kildeid'
=> $this->db2->f('kildeid'),
+ 'pmwrkord_code' =>
$this->db2->f('pmwrkord_code'),
+ 'belop'
=> $this->db2->f('belop'),
+ 'fakturadato' =>
$this->db2->f('fakturadato'),
+ 'periode'
=> $this->db2->f('periode'),
+ 'forfallsdato' =>
$this->db2->f('forfallsdato'),
+ 'fakturanr'
=> $this->db2->f('fakturanr'),
+ 'spbudact_code' =>
$this->db2->f('spbudact_code'),
+ 'regtid'
=> $this->db2->f('regtid'),
+ 'artid'
=> $this->db2->f('artid'),
+ 'godkjentbelop' =>
$this->db2->f('godkjentbelop'),
+ 'spvend_code' =>
$this->db2->f('spvend_code'),
+ 'dima'
=> $this->db2->f('dima'),
+ 'loc1'
=> $this->db2->f('loc1'),
+ 'dimb'
=> $this->db2->f('dimb'),
+ 'mvakode'
=> $this->db2->f('mvakode'),
+ 'dimd'
=> $this->db2->f('dimd'),
+ 'dime'
=> $this->db2->f('dime'),
+ 'project_id' =>
$this->db2->f('project_id'),
+ 'kostra_id'
=> $this->db2->f('kostra_id'),
+ 'oppsynsmannid' =>
$this->db2->f('oppsynsmannid'),
+ 'saksbehandlerid' =>
$this->db2->f('saksbehandlerid'),
+ 'budsjettansvarligid' =>
$this->db2->f('budsjettansvarligid'),
+ 'oppsynsigndato' =>
$this->db2->f('oppsynsigndato'),
+ 'saksigndato' =>
$this->db2->f('saksigndato'),
+ 'budsjettsigndato' =>
$this->db2->f('budsjettsigndato'),
+ 'merknad'
=> $this->db2->f('merknad'),
+ 'line_text'
=> $this->db2->f('line_text'),
+ 'splitt'
=> $this->db2->f('splitt'),
+ 'utbetalingid' =>
$this->db2->f('utbetalingid'),
+ 'utbetalingsigndato' =>
$this->db2->f('utbetalingsigndato'),
+ 'district_id' =>
$this->db2->f('district_id'),
+ 'item_type'
=> $this->db2->f('item_type'),
+ 'item_id'
=> $this->db2->f('item_id')
);
-
}
return $values;
}
-
- function
OverforPeriode($batchid,$periode,$download,$pre_transfer='',$force_period_year='')
+ function OverforPeriode($batchid, $periode, $download,
$force_period_year = '')
{
$BilagId = 'NULL';
//Bestem filnavn
- $Filnavn = $this->LagFilnavn($batchid,$pre_transfer);
- if (!$Filnavn)
+ $Filnavn = $this->LagFilnavn($batchid);
+ if(!$Filnavn)
{
- $message='LagFilnavn: Alle loepenr for filnavn
er i bruk';
- $this->errorhandler($batchid,$message);
- phpgwapi_cache::message_set($message, 'error');
+ $message = 'LagFilnavn: Alle loepenr for
filnavn er i bruk';
+ $this->errorhandler($batchid, $message);
+ phpgwapi_cache::message_set($message, 'error');
return false;
}
//Test om filen kan opprettes og skrives til
- if (@fopen($Filnavn, "wb"))
+ if(@fopen($Filnavn, "wb"))
{
unlink($Filnavn);
}
else
{
- phpgwapi_cache::message_set('kan ikke lagre til
fil: '. $Filnavn, 'error');
+ phpgwapi_cache::message_set('kan ikke lagre til
fil: ' . $Filnavn, 'error');
return false;
}
@@ -681,7 +606,7 @@
$this->db->transaction_begin();
- $oRsBilag =
$this->get_vouchers_to_transfer($periode,$pre_transfer);
+ $oRsBilag = $this->get_vouchers_to_transfer($periode);
$buffer = '';
@@ -691,14 +616,14 @@
$tranfser_bilag[] = $invoice['bilagsnr'];
//Bestem belops felt
- if ($invoice['splitt']==0)
+ if($invoice['splitt'] == 0)
{
//Bilaget er ikke splittet
- if ($invoice['godkjentbelop'] <>
$invoice['belop'])
+ if($invoice['godkjentbelop'] <>
$invoice['belop'])
{
$BelopFelt = 'godkjentbelop';
//Logg til avviks tabell
- if ($download=='on' &&
!$pre_transfer)
+ if($download == 'on')
{
//
$this->soXport->log_to_deviation_table($invoice);
}
@@ -710,295 +635,234 @@
}
//Bilaget er splittet
- if ($invoice['godkjentbelop'] ==
$invoice['belop'])
+ if($invoice['godkjentbelop'] ==
$invoice['belop'])
{
$BelopFelt = 'godkjentbelop';
}
else
{
- //Ikke lovlig
+ //Ikke lovlig
$message = lang('Avvik mellom
fakturabelop og godkjent belop pa splittet faktura!');
- $this->errorhandler($batchid,$message);
+ $this->errorhandler($batchid, $message);
return $message;
}
- $Belop_motpost =$invoice[$BelopFelt] *100;
+ $Belop_motpost = $invoice[$BelopFelt] * 100;
//Skriv hovedbilag
- $Buntnr =
sprintf("%-12s",basename($Filnavn,".TXT"));// verdi: MMDDFL, type: c12, plass:
1 - 12
- $Forsystem = 'BI';// verdi: BI, type: c2,
plass: 13 - 14
+ $Buntnr = sprintf("%-12s",
basename($Filnavn, ".TXT"));// verdi: MMDDFL, type: c12, plass: 1 - 12
+ $Forsystem = 'BI';// verdi: BI, type: c2,
plass: 13 - 14
- $Transtype = 'GL';// verdi: GL, type: c2,
plass: 17 - 18
- $Firmakode = sprintf("%-2s",'BB');//
verdi: Firmakode, type: c2, plass: 19 - 20
+ $Transtype = 'GL';// verdi: GL, type: c2,
plass: 17 - 18
+ $Firmakode = sprintf("%-2s", 'BY');//
verdi: Firmakode, type: c2, plass: 19 - 20
- $Valuteringsdato=
date(Ymd,strtotime($invoice['fakturadato']));// verdi: Dato, type: date, plass:
251 - 258
- $Bilagsdato =
date(Ymd,strtotime($invoice['fakturadato'])) ;// verdi: Dato, type: date,
plass: 259 - 266
- $Bilagsnr =
sprintf("%-9s",substr($invoice['bilagsnr'],-8));// verdi: Bilagsnummer, type:
i4, plass: 267 - 275
- // $_periode =
sprintf("%06s",date(Y,strtotime($invoice['fakturadato'])) .
sprintf("%02d",$periode));// verdi: Periode, type: i4, plass: 276 - 281
- $ESL = sprintf("%1s",'');// verdi:
Blank, type: i+C481, plass: 282 - 282
+ $Valuteringsdato = date(Ymd,
strtotime($invoice['fakturadato']));// verdi: Dato, type: date, plass: 251 - 258
+ $Bilagsdato = date(Ymd,
strtotime($invoice['fakturadato']));// verdi: Dato, type: date, plass: 259 - 266
+ $Bilagsnr = sprintf("%-9s",
substr($invoice['bilagsnr'], -8));// verdi: Bilagsnummer, type: i4, plass: 267
- 275
+ // $_periode =
sprintf("%06s",date(Y,strtotime($invoice['fakturadato'])) .
sprintf("%02d",$periode));// verdi: Periode, type: i4, plass: 276 - 281
+ $ESL = sprintf("%1s",
'');// verdi: Blank, type: i+C481, plass: 282 - 282
- if($pre_transfer)
- {
- if(abs(date('m',time()) - $periode) >1)
- {
- $temp_period = date('m',time())
-1;
+ $_periode = $periode;
- if($temp_period == 0)
- {
- $temp_period =1;
- }
+ $Bilagsart = sprintf("%2s", 'HK');//
verdi: , type: c2, plass: 15 - 16
+ $Forfall = date(Ymd,
strtotime($invoice['forfallsdato']));// verdi: Forfallsdato , type: date,
plass: 298 - 305
- $temp_year = date('Y',time());
- }
- else
- {
- $temp_period = $periode;
- $temp_year =
date('Y',strtotime($invoice['fakturadato']));
- }
+ $Rab_forf = sprintf("%-8s", '');//
verdi: Blank, type: date, plass: 306 - 313
+ $Rabatt = sprintf("%020s", '');//
verdi: Blank, type: money, plass: 314 - 333
+ $Avt_Kon = sprintf("%-8s", '');//
verdi: Blank, type: c8, plass: 334 - 341
- $_periode =
sprintf("%06s",$temp_year . sprintf("%02d",$temp_period));// verdi: Periode,
type: i4, plass: 276 - 281
- $Bilagsart =
sprintf("%2s",'FF');// verdi: , type: c2, plass: 15 - 16
- $Forfall = '20991231';// verdi:
Forfallsdato , type: date, plass: 298 - 305
- }
- else
- {
- $_periode = $periode;
+ $Kid = sprintf("%-27s",
$invoice['kidnr']);// verdi: Kid, type: c27, plass: 351 - 377
+ $Bet_overforing = sprintf("%-2s", '');//
verdi: Blank, type: c2, plass: 378 - 379
+ $Status = 'N';// verdi: N,
type: c1, plass: 380 - 380
+ $Resk_type = 'P';// verdi: Blank,
type: c1, plass: 381 - 381
+ $Resk_nr = sprintf("%-9s",
$invoice['spvend_code']);// verdi: Blank., type: i4, plass: 382 - 390
+ $Forskudd = '0';// verdi: 0,
type: i1, plass: 391 - 391
+ $Fakturaref = '000000000';//
verdi: 0, type: i4, plass: 392 - 400
+ $Fakturaref = '000000000';//
verdi: 0, type: i4, plass: 401 - 409
+ $Inkassokode = sprintf("%-6s", '');//
verdi: Blank, type: c6, plass: 410 - 415
+ $Bet_mottager = sprintf("%-8s", '');//
verdi: Blank, type: c8, plass: 416 - 423
+ $Att_ansvarlig = sprintf("%-6s",
utf8_decode($invoice['saksbehandler']));// verdi: Blank, type: c6, plass: 424 -
429
- $Bilagsart =
sprintf("%2s",'HK');// verdi: , type: c2, plass: 15 - 16
- $Forfall =
date(Ymd,strtotime($invoice['forfallsdato']));// verdi: Forfallsdato , type:
date, plass: 298 - 305
- }
-
- $Rab_forf = sprintf("%-8s",'');// verdi:
Blank, type: date, plass: 306 - 313
- $Rabatt = sprintf("%020s",'');// verdi:
Blank, type: money, plass: 314 - 333
- $Avt_Kon = sprintf("%-8s",'');// verdi:
Blank, type: c8, plass: 334 - 341
-
- $Kid =
sprintf("%-27s",$invoice['kidnr']);// verdi: Kid, type: c27, plass: 351 - 377
- $Bet_overforing = sprintf("%-2s",'');// verdi:
Blank, type: c2, plass: 378 - 379
- $Status = 'N';// verdi: N, type: c1,
plass: 380 - 380
- $Resk_type = 'P';// verdi: Blank, type:
c1, plass: 381 - 381
- $Resk_nr =
sprintf("%-9s",$invoice['spvend_code']);// verdi: Blank., type: i4, plass: 382
- 390
- $Forskudd = '0';// verdi: 0, type: i1,
plass: 391 - 391
- $Fakturaref = '000000000';// verdi: 0,
type: i4, plass: 392 - 400
- $Fakturaref = '000000000';// verdi: 0,
type: i4, plass: 401 - 409
- $Inkassokode = sprintf("%-6s",'');// verdi:
Blank, type: c6, plass: 410 - 415
- $Bet_mottager = sprintf("%-8s",'');// verdi:
Blank, type: c8, plass: 416 - 423
- $Att_ansvarlig =
sprintf("%-6s",utf8_decode($invoice['saksbehandler']));// verdi: Blank, type:
c6, plass: 424 - 429
-
$vendor_info =
$this->get_vendor_info($invoice['spvend_code']);
if(!$vendor_info['org_nr'])
{
$message = 'mangler org_nr for
reskontronr: ' . $invoice['spvend_code'];
- $this->errorhandler($batchid,$message);
+ $this->errorhandler($batchid, $message);
return $message;
}
if(!$vendor_info['konto_nr'])
{
$message = 'mangler konto for
reskontronr: ' . $invoice['spvend_code'];
- $this->errorhandler($batchid,$message);
+ $this->errorhandler($batchid, $message);
return $message;
}
- $Resk_navn =
sprintf("%-50s",$vendor_info['org_nr']);// verdi: Fødselsnr, type: c50, plass:
430 - 479
- $Postadresse = sprintf("%-160s",'');//
verdi: Blank, type: c160, plass: 480 - 639
- $Stat_Provins = sprintf("%-50s",'');// verdi:
Blank, type: c50, plass: 640 - 689
- $Sted = sprintf("%-50s",'');// verdi:
Blank, type: c50, plass: 690 - 739
- $Bank_Postgiro_kontonr =
sprintf("%-35s",str_replace(" ","",$vendor_info['konto_nr']));// verdi:
konto_nr, type: c35, plass: 740 - 774
- $Betalingsmate = sprintf("%-2s",'');// verdi:
Blank, type: c2, plass: 775 - 776
- $Mva_reg_nr = sprintf("%-25s",'');// verdi:
Blank, type: c25, plass: 777 - 801
- $Postnummer = sprintf("%-15s",'');// verdi:
Blank, type: c15, plass: 802 - 816
- $Val_dok = sprintf("%-3s",'');// verdi:
Blank, type: c3, plass: 817 - 819
+ $Resk_navn =
sprintf("%-50s", $vendor_info['org_nr']);// verdi: Fødselsnr, type: c50, plass:
430 - 479
+ $Postadresse =
sprintf("%-160s", '');// verdi: Blank, type: c160, plass: 480 - 639
+ $Stat_Provins =
sprintf("%-50s", '');// verdi: Blank, type: c50, plass: 640 - 689
+ $Sted =
sprintf("%-50s", '');// verdi: Blank, type: c50, plass: 690 - 739
+ $Bank_Postgiro_kontonr = sprintf("%-35s",
str_replace(" ", "", $vendor_info['konto_nr']));// verdi: konto_nr, type: c35,
plass: 740 - 774
+ $Betalingsmate =
sprintf("%-2s", '');// verdi: Blank, type: c2, plass: 775 - 776
+ $Mva_reg_nr =
sprintf("%-25s", '');// verdi: Blank, type: c25, plass: 777 - 801
+ $Postnummer =
sprintf("%-15s", '');// verdi: Blank, type: c15, plass: 802 - 816
+ $Val_dok =
sprintf("%-3s", '');// verdi: Blank, type: c3, plass: 817 - 819
+ $underbilag_count =
count($invoice['invoice_line']);
+ $last_record = $underbilag_count -
1;
- $underbilag_count=
count($invoice['invoice_line']);
- $last_record = $underbilag_count - 1;
-
//Velg ut alle underbilag
foreach($invoice['invoice_line'] as $_key =>
$invoice_line)
{
-
$BilagId = $invoice_line['id'];
- $Belop = $invoice_line[$BelopFelt]*100;
- $Belop_ = $Belop;
+ $Belop = $invoice_line[$BelopFelt] *
100;
+ $Belop_ = $Belop;
if($Belop < 0)
{
- $Belop = abs($Belop);
- $Belop =
sprintf("%019s",$Belop);
- $Belop = '-' . $Belop;
+ $Belop = abs($Belop);
+ $Belop = sprintf("%019s",
$Belop);
+ $Belop = '-' . $Belop;
}
else
{
- $Belop =
sprintf("%019s",$Belop);
- $Belop = '+' . $Belop;
+ $Belop = sprintf("%019s",
$Belop);
+ $Belop = '+' . $Belop;
}
-
if($invoice_line['pmwrkord_code'])
{
$orders_affected[$BilagOverf[$i]['pmwrkord_code']] = true;
//Oppdater beløp på arbeidsordre
- if ($download=='on' &&
!$pre_transfer)
+ if($download == 'on')
{
- if
($invoice_line['dimd'] % 2 == 0)
+
if($invoice_line['dimd'] % 2 == 0)
{
-
$actual_cost_field='act_mtrl_cost';
+
$actual_cost_field = 'act_mtrl_cost';
}
else
{
-
$actual_cost_field='act_vendor_cost';
+
$actual_cost_field = 'act_vendor_cost';
}
- $operator='+';
+ $operator = '+';
if(!$this->debug)
{
-
$this->soXport->correct_actual_cost($invoice_line['pmwrkord_code'],$Belop_,$actual_cost_field,$operator);
+
$this->soXport->correct_actual_cost($invoice_line['pmwrkord_code'], $Belop_,
$actual_cost_field, $operator);
}
}
}
//Overfør til fm_ecobilagoverf
- $invoice_line['filnavn']=
basename($Filnavn);
-
$invoice_line['ordrebelop']=$invoice_line[$BelopFelt];
+ $invoice_line['filnavn'] =
basename($Filnavn);
+ $invoice_line['ordrebelop'] =
$invoice_line[$BelopFelt];
- //dersom det mangler budsjett konto -
kun aktuelt for ikke godkjent - sett konto til 2899999
+ $Konto = sprintf("%08s",
$invoice_line['spbudact_code']);// verdi: Art, type: c8, plass: 21 - 28
+ $Dim_1 = sprintf("%08s",
$invoice_line['dimb']);// 64040 verdi: Ansvarssted, type: c8, plass: 29 - 36
+ $Dim_2 = sprintf("%-8s",
$invoice_line['kostra_id']);// verdi: Tjeneste, type: c8, plass: 37 - 44
+ $Dim_3 = sprintf("%-8s",
substr($invoice_line['dima'], 0, 6));// verdi: Objekt-bygg, type: c8, plass: 45
- 52
- if(!$invoice_line['spbudact_code'] &&
$pre_transfer)
- {
- $invoice_line['spbudact_code']
= 12304361;
- }
-
-
- //dersom ikke gyldig objekt - kun
aktuelt for ikke godkjent - sett objekt til 9999
-
- if(!($invoice_line['kostra_id']>0) &&
$pre_transfer)
- {
- $invoice_line['kostra_id'] =
26550;
- $invoice_line['mvakode'] = 0;
- $invoice_line['dima'] = 9999;
- }
-
- $Konto =
sprintf("%08s",$invoice_line['spbudact_code']);// verdi: Art, type: c8, plass:
21 - 28
- $Dim_1 =
sprintf("%08s",$invoice_line['dimb']);// 64040 verdi: Ansvarssted, type: c8,
plass: 29 - 36
- $Dim_2 =
sprintf("%-8s",$invoice_line['kostra_id']);// verdi: Tjeneste, type: c8, plass:
37 - 44
-
- if($pre_transfer)
- {
- $Dim_3 =
sprintf("%-8s",substr($invoice_line['dima'],0,4));// verdi: Objekt, type: c8,
plass: 45 - 52
- }
- else
- {
- $Dim_3 =
sprintf("%-8s",substr($invoice_line['dima'],0,6));// verdi: Objekt-bygg, type:
c8, plass: 45 - 52
- }
-
-
- $Dim_4 = sprintf("%-8s",'');//
verdi: Ressurs, type: c8, plass: 53 - 60
- $Dim_5 =
sprintf("%-12s",$invoice_line['project_id']);// verdi: Prosjekt, type: c12,
plass: 61 - 72
-
+ $Dim_4 = sprintf("%-8s", '');//
verdi: Ressurs, type: c8, plass: 53 - 60
+ $Dim_5 = sprintf("%-12s",
$invoice_line['project_id']);// verdi: Prosjekt, type: c12, plass: 61 - 72
//FIXME 'dime' må legges inn...
- $Dim_6 =
sprintf("%-4s",$invoice_line['dime']);// Kategori, type: c4, plass: 73 - 76
+ $Dim_6 = sprintf("%-4s",
$invoice_line['dime']);// Kategori, type: c4, plass: 73 - 76
- $Dim_7 = sprintf("%-4s",'');//
verdi: Blank, type: c4, plass: 77 - 80
+ $Dim_7 = sprintf("%-4s", '');// verdi:
Blank, type: c4, plass: 77 - 80
-
$Avgiftskode=sprintf("%-2s",$invoice_line['mvakode']);// verdi: Avgiftskode,
type: c2, plass: 81 - 82
+ $Avgiftskode = sprintf("%-2s",
$invoice_line['mvakode']);// verdi: Avgiftskode, type: c2, plass: 81 - 82
- $Avgiftssystem = sprintf("%2s",'');//
verdi: Blank, type: c2, plass: 83 - 84
- $Valutakode ='NOK';// verdi: NOK,
type: c3, plass: 85 - 87
- $Debet_Kredit = sprintf("%2s",'');//
verdi: Blank, type: i2, plass: 88 - 89
- $Valutabelop = $Belop;// verdi:
Beløp, type: money, plass: 90 - 109
- $Belop_i_firmavaluta=$Belop;// verdi:
Beløp, type: money, plass: 110 - 129
- $Antall = sprintf("%11s",'');//
verdi: Blank, type: i4, plass: 130 - 140
- $Belop2 = sprintf("%20s",'');//
verdi: Blank, type: f8, plass: 141 - 160
- $Belop3 = sprintf("%20s",'');//
verdi: Blank, type: money, plass: 161 - 180
+ $Avgiftssystem =
sprintf("%2s", '');// verdi: Blank, type: c2, plass: 83 - 84
+ $Valutakode =
'NOK';// verdi: NOK, type: c3, plass: 85 - 87
+ $Debet_Kredit =
sprintf("%2s", '');// verdi: Blank, type: i2, plass: 88 - 89
+ $Valutabelop = $Belop;//
verdi: Beløp, type: money, plass: 90 - 109
+ $Belop_i_firmavaluta = $Belop;// verdi:
Beløp, type: money, plass: 110 - 129
+ $Antall =
sprintf("%11s", '');// verdi: Blank, type: i4, plass: 130 - 140
+ $Belop2 =
sprintf("%20s", '');// verdi: Blank, type: f8, plass: 141 - 160
+ $Belop3 =
sprintf("%20s", '');// verdi: Blank, type: money, plass: 161 - 180
+ // $Belop4 (også kalt "money3"
)blir brukt for identifisere overføring på tvers av filer.
+ $Belop4 =
sprintf("%20s", $batchid);// verdi: Blank, type: money, plass: 181 - 200 -
batch_id høyre justert
- // $Belop4 (også kalt "money3" )blir brukt
for identifisere overføring på tvers av filer.
- $Belop4 =
sprintf("%20s",$batchid);// verdi: Blank, type: money, plass: 181 - 200 -
batch_id høyre justert
+ /*
+ if($invoice_line['pmwrkord_code'])
+ {
+ $Tekst =
sprintf("%-50s",substr(utf8_decode($this->get_order_title($invoice_line['pmwrkord_code'])),0,50));//sprintf("%-50s",substr($invoice_line['merknad'],0,50));//
verdi: Tekst, type: text (50), plass: 201 - 250
+ }
+ else
+ {
+ $Tekst =
sprintf("%-50s",'');//sprintf("%-50s",substr($invoice_line['merknad'],0,50));//
verdi: Tekst, type: text (50), plass: 201 - 250
+ }
+ */
+ $Tekst = sprintf("%-50s",
substr($invoice_line['fakturanr'], 0, 50));
-/*
- if($invoice_line['pmwrkord_code'])
- {
- $Tekst =
sprintf("%-50s",substr(utf8_decode($this->get_order_title($invoice_line['pmwrkord_code'])),0,50));//sprintf("%-50s",substr($invoice_line['merknad'],0,50));//
verdi: Tekst, type: text (50), plass: 201 - 250
- }
- else
- {
- $Tekst =
sprintf("%-50s",'');//sprintf("%-50s",substr($invoice_line['merknad'],0,50));//
verdi: Tekst, type: text (50), plass: 201 - 250
- }
-*/
- $Tekst =
sprintf("%-50s",substr($invoice_line['fakturanr'],0,50));
+ $Fakturanr = sprintf("%-15s",
substr(utf8_decode($invoice_line['fakturanr']), 0, 15));// verdi: Fakturanr,
type: c15, plass: 283 - 297
- $Fakturanr =
sprintf("%-15s",substr(utf8_decode($invoice_line['fakturanr']), 0, 15));//
verdi: Fakturanr, type: c15, plass: 283 - 297
-
- $Ordrenummer =
sprintf("%-9s",$invoice_line['pmwrkord_code']);// verdi: Infodoc ordrenr, type:
i4, plass: 342 - 350
-
-
+ $Ordrenummer = sprintf("%-9s",
$invoice_line['pmwrkord_code']);// verdi: Infodoc ordrenr, type: i4, plass: 342
- 350
//Kopier verdier
- if ($download=='on' && !$pre_transfer
&& !$this->debug)
+ if($download == 'on' && !$this->debug)
{
$this->soXport->add_OverfBilag($invoice_line);
}
//Skriv til fil
- $buffer .= $Buntnr . $Forsystem .
$Bilagsart . $Transtype . $Firmakode . $Konto . $Dim_1 . $Dim_2 . $Dim_3 .
$Dim_4 .
- $Dim_5 . $Dim_6 . $Dim_7 . $Avgiftskode
. $Avgiftssystem . $Valutakode . $Debet_Kredit . $Valutabelop .
- $Belop_i_firmavaluta . $Antall .
$Belop2 . $Belop3 . $Belop4 . $Tekst . $Valuteringsdato . $Bilagsdato .
- $Bilagsnr . $_periode . $ESL .
$Fakturanr . $Forfall . $Rab_forf . $Rabatt . $Avt_Kon . $Ordrenummer .
- $Kid . $Bet_overforing . $Status .
$Resk_type . $Resk_nr . $Forskudd . $Fakturaref . $Fakturaref .
- $Inkassokode . $Bet_mottager .
$Att_ansvarlig . $Resk_navn . $Postadresse . $Stat_Provins . $Sted .
- $Bank_Postgiro_kontonr . $Betalingsmate
. $Mva_reg_nr . $Postnummer . $Val_dok ."\r\n";
+ $buffer .= $Buntnr . $Forsystem .
$Bilagsart . $Transtype . $Firmakode . $Konto . $Dim_1 . $Dim_2 . $Dim_3 .
$Dim_4 .
+ $Dim_5 . $Dim_6 . $Dim_7 . $Avgiftskode
. $Avgiftssystem . $Valutakode . $Debet_Kredit . $Valutabelop .
+ $Belop_i_firmavaluta . $Antall .
$Belop2 . $Belop3 . $Belop4 . $Tekst . $Valuteringsdato . $Bilagsdato .
+ $Bilagsnr . $_periode . $ESL .
$Fakturanr . $Forfall . $Rab_forf . $Rabatt . $Avt_Kon . $Ordrenummer .
+ $Kid . $Bet_overforing . $Status .
$Resk_type . $Resk_nr . $Forskudd . $Fakturaref . $Fakturaref .
+ $Inkassokode . $Bet_mottager .
$Att_ansvarlig . $Resk_navn . $Postadresse . $Stat_Provins . $Sted .
+ $Bank_Postgiro_kontonr . $Betalingsmate
. $Mva_reg_nr . $Postnummer . $Val_dok . "\r\n";
- if($_key==$last_record)
+ if($_key == $last_record)
{
- $Konto =
sprintf("%-8s",'2139915');// verdi: Art, type: c8, plass: 21 - 28
- $Dim_1 =
sprintf("%08s",$invoice_line['dimb']);//sprintf("%-8s",'');// verdi:
Ansvarssted, type: c8, plass: 29 - 36
- $Dim_2 =
sprintf("%-8s",'');// verdi: Tjeneste, type: c8, plass: 37 - 44
- $Dim_3 =
sprintf("%-8s",'');// verdi: Objekt, type: c8, plass: 45 - 52
- $Dim_4 =
sprintf("%-8s",'');// verdi: Ressurs, type: c8, plass: 53 - 60
- $Dim_5 =
sprintf("%-12s",'');// verdi: Prosjekt, type: c12, plass: 61 - 72
- $Dim_6 =
sprintf("%-4s",'');// verdi: Blank, type: c4, plass: 73 - 76
- $Dim_7 =
sprintf("%-4s",'');// verdi: Blank, type: c4, plass: 77 - 80
- $Fakturanr =
sprintf("%-15s",'');// verdi: Fakturanr, type: c15, plass: 283 - 297
- $Ordrenummer =
sprintf("%-9s",'');// verdi: Infodoc ordrenr, type: i4, plass: 342 - 350
- // $Tekst =
sprintf("%-50s",'');//sprintf("%-50s",substr($invoice_line['merknad'],0,50));//
verdi: Tekst, type: text (50), plass: 201 - 250
- $Tekst =
sprintf("%-50s",substr($invoice_line['fakturanr'],0,50));// verdi: Tekst, type:
text (50), plass: 201 - 250
-
+ $Konto =
sprintf("%-8s", '2139915');// verdi: Art, type: c8, plass: 21 - 28
+ $Dim_1 =
sprintf("%08s", $invoice_line['dimb']);//sprintf("%-8s",'');// verdi:
Ansvarssted, type: c8, plass: 29 - 36
+ $Dim_2 =
sprintf("%-8s", '');// verdi: Tjeneste, type: c8, plass: 37 - 44
+ $Dim_3 =
sprintf("%-8s", '');// verdi: Objekt, type: c8, plass: 45 - 52
+ $Dim_4 =
sprintf("%-8s", '');// verdi: Ressurs, type: c8, plass: 53 - 60
+ $Dim_5 =
sprintf("%-12s", '');// verdi: Prosjekt, type: c12, plass: 61 - 72
+ $Dim_6 =
sprintf("%-4s", '');// verdi: Blank, type: c4, plass: 73 - 76
+ $Dim_7 =
sprintf("%-4s", '');// verdi: Blank, type: c4, plass: 77 - 80
+ $Fakturanr =
sprintf("%-15s", '');// verdi: Fakturanr, type: c15, plass: 283 - 297
+ $Ordrenummer = sprintf("%-9s",
'');// verdi: Infodoc ordrenr, type: i4, plass: 342 - 350
+ // $Tekst =
sprintf("%-50s",'');//sprintf("%-50s",substr($invoice_line['merknad'],0,50));//
verdi: Tekst, type: text (50), plass: 201 - 250
+ $Tekst =
sprintf("%-50s", substr($invoice_line['fakturanr'], 0, 50));// verdi: Tekst,
type: text (50), plass: 201 - 250
//Ikke fortegnskifte for
kostfordeling (GL)
if($Belop_motpost < 0)
{
- $Belop_motpost =
sprintf("%019s",abs($Belop_motpost));
- $Belop_motpost = '-' .
$Belop_motpost;
+ $Belop_motpost =
sprintf("%019s", abs($Belop_motpost));
+ $Belop_motpost = '-'
. $Belop_motpost;
}
else
{
- $Belop_motpost =
sprintf("%019s",$Belop_motpost);
- $Belop_motpost = '+' .
$Belop_motpost;
-
+ $Belop_motpost =
sprintf("%019s", $Belop_motpost);
+ $Belop_motpost = '+'
. $Belop_motpost;
}
- $Transtype = 'GL';//
verdi: GL, type: c2, plass: 17 - 18
- $Valutabelop =
$Belop_motpost;// verdi: Beløp, type: money, plass: 90 - 109
-
$Belop_i_firmavaluta=$Belop_motpost;// verdi: Beløp, type: money, plass: 110 -
129
+ $Transtype
= 'GL';// verdi: GL, type: c2, plass: 17 - 18
+ $Valutabelop =
$Belop_motpost;// verdi: Beløp, type: money, plass: 90 - 109
+ $Belop_i_firmavaluta =
$Belop_motpost;// verdi: Beløp, type: money, plass: 110 - 129
- $buffer .= $Buntnr . $Forsystem
. $Bilagsart . $Transtype . $Firmakode . $Konto . $Dim_1 . $Dim_2 . $Dim_3 .
$Dim_4 .
- $Dim_5 . $Dim_6 . $Dim_7 .
$Avgiftskode . $Avgiftssystem . $Valutakode . $Debet_Kredit . $Valutabelop .
- $Belop_i_firmavaluta . $Antall
. $Belop2 . $Belop3 . $Belop4 . $Tekst . $Valuteringsdato . $Bilagsdato .
- $Bilagsnr . $_periode . $ESL .
$Fakturanr . $Forfall . $Rab_forf . $Rabatt . $Avt_Kon . $Ordrenummer .
- $Kid . $Bet_overforing .
$Status . $Resk_type . $Resk_nr . $Forskudd . $Fakturaref . $Fakturaref .
- $Inkassokode . $Bet_mottager .
$Att_ansvarlig . $Resk_navn . $Postadresse . $Stat_Provins . $Sted .
- $Bank_Postgiro_kontonr .
$Betalingsmate . $Mva_reg_nr . $Postnummer . $Val_dok ."\r\n";
+ $buffer .= $Buntnr . $Forsystem
. $Bilagsart . $Transtype . $Firmakode . $Konto . $Dim_1 . $Dim_2 . $Dim_3 .
$Dim_4 .
+ $Dim_5 . $Dim_6 . $Dim_7 .
$Avgiftskode . $Avgiftssystem . $Valutakode . $Debet_Kredit . $Valutabelop .
+ $Belop_i_firmavaluta . $Antall
. $Belop2 . $Belop3 . $Belop4 . $Tekst . $Valuteringsdato . $Bilagsdato .
+ $Bilagsnr . $_periode . $ESL .
$Fakturanr . $Forfall . $Rab_forf . $Rabatt . $Avt_Kon . $Ordrenummer .
+ $Kid . $Bet_overforing .
$Status . $Resk_type . $Resk_nr . $Forskudd . $Fakturaref . $Fakturaref .
+ $Inkassokode . $Bet_mottager .
$Att_ansvarlig . $Resk_navn . $Postadresse . $Stat_Provins . $Sted .
+ $Bank_Postgiro_kontonr .
$Betalingsmate . $Mva_reg_nr . $Postnummer . $Val_dok . "\r\n";
}
//Slett post i fm_ecobilag
- if ($download=='on' && !$pre_transfer
&& !$this->debug)
+ if($download == 'on' && !$this->debug)
{
$this->soXport->delete_from_fm_ecobilag($invoice_line['id']);
//Logg transaksjon
-
$this->soXport->log_transaction($batchid,$BilagId,lang('Invoice transferred'));
+
$this->soXport->log_transaction($batchid, $BilagId, lang('Invoice
transferred'));
}
$BilagId = 'NULL';
@@ -1009,99 +873,61 @@
//Fullfør transaksjon
- if ($download=='on' && !$pre_transfer && !$this->debug):
+ if($download == 'on' && !$this->debug)
{
$fp = fopen($Filnavn, "wb");
- fwrite($fp,$buffer);
+ fwrite($fp, $buffer);
if(fclose($fp))
{
- $file_written=True;
+ $file_written = True;
}
- if($file_written &&
$this->config->config_data['common']['method']!='ftp'):
+ if($file_written &&
$this->config->config_data['common']['method'] != 'ftp')
{
$transfer_ok = True;
}
- elseif($file_written):
+ else if($file_written)
{
- $transfer_ok =
$this->transfer($buffer,$Filnavn,$batchid,$tranfser_bilag);
+ $transfer_ok = $this->transfer($buffer,
$Filnavn, $batchid, $tranfser_bilag);
}
- endif;
if($transfer_ok)
{
$this->db->transaction_commit();
- $message = 'Godkjent: periode:
'.$_periode.' antall bilag/underbilag overfort:'.$antall . ' , fil: ' .
$Filnavn;
- phpgwapi_cache::message_set($message,
'message');
+ $message = 'Godkjent: periode: ' .
$_periode . ' antall bilag/underbilag overfort:' . $antall . ' , fil: ' .
$Filnavn;
+ phpgwapi_cache::message_set($message,
'message');
}
else
{
$this->db->transaction_abort();
$message = 'Noe gikk galt med
overforing av godkjendte fakturaer!';
- phpgwapi_cache::message_set($message,
'error');
+ phpgwapi_cache::message_set($message,
'error');
}
}
- elseif($download=='on' && $pre_transfer &&
!$this->debug):
+ else
{
-
- $fp = fopen($Filnavn, "wb");
- fwrite($fp,$buffer);
-
- if(fclose($fp))
- {
- $file_written=True;
- }
-
- if($file_written &&
$this->config->config_data['common']['method']!='ftp'):
- {
- $transfer_ok = True;
- }
- elseif($file_written):
- {
- $transfer_ok =
$this->transfer($buffer,$Filnavn,$batchid,$tranfser_bilag);
- }
- endif;
-
- if($transfer_ok)
- {
-
$this->soXport->update_actual_cost_from_archive($this->orders_affected);
-
- $this->db->transaction_commit();
- $message = 'Ankomstregistrering:
periode: '.$periode.' antall bilag/underbilag overfort:'.$antall . ' , fil: ' .
$Filnavn;
- phpgwapi_cache::message_set($message,
'message');
- }
- else
- {
- $this->db->transaction_abort();
- $message = 'Noe gikk galt med
ankomstregistrering!';
- phpgwapi_cache::message_set($message,
'error');
- }
- }
- else:
- {
$this->db->transaction_abort();
_debug_array($Filnavn);
$fp = fopen($Filnavn, "wb");
- fwrite($fp,$buffer);
+ fwrite($fp, $buffer);
if(fclose($fp))
{
- $file_written=True;
+ $file_written = True;
}
echo "<pre>{$buffer}</pre>";
}
- endif;
}
- function transfer($buffer,$Filnavn,$batchid,$tranfser_bilag)
+ function transfer($buffer, $Filnavn, $batchid, $tranfser_bilag)
{
-
if($this->config->config_data['common']['method']=='ftp')
+ if($this->config->config_data['common']['method'] ==
'ftp')
{
- $ftp = $this->phpftp_connect();
+ $ftp = $this->phpftp_connect();
$basedir =
$this->config->config_data['common']['remote_basedir'];
if($basedir)
@@ -1113,19 +939,19 @@
$newfile = basename($Filnavn);
}
- if (ftp_put($ftp,$newfile, $Filnavn,
FTP_BINARY))
+ if(ftp_put($ftp, $newfile, $Filnavn,
FTP_BINARY))
{
- for
($i=0;$i<count($tranfser_bilag);$i++)
+ for($i = 0; $i <
count($tranfser_bilag); $i++)
{
-
$this->soXport->log_transaction($batchid,$tranfser_bilag[$i],lang('Invoice
pre_transferred %1',basename($Filnavn)));
+
$this->soXport->log_transaction($batchid, $tranfser_bilag[$i], lang('Invoice
pre_transferred %1', basename($Filnavn)));
}
$transfer_ok = True;
}
else
{
- for
($i=0;$i<count($tranfser_bilag);$i++)
+ for($i = 0; $i <
count($tranfser_bilag); $i++)
{
-
$this->soXport->log_transaction($batchid,$tranfser_bilag[$i],lang('Failed to
pre_transfere %1 to agresso',basename($Filnavn)));
+
$this->soXport->log_transaction($batchid, $tranfser_bilag[$i], lang('Failed to
pre_transfere %1 to agresso', basename($Filnavn)));
}
$transfer_ok = False;
}
@@ -1136,23 +962,23 @@
ftp_quit($ftp);
}
- return $transfer_ok;
+ return $transfer_ok;
}
- function phpftp_connect()
+ function phpftp_connect()
{
- $host =
$this->config->config_data['common']['host'];
- $user =
$this->config->config_data['common']['user'];
- $password =
$this->config->config_data['common']['password'];
+ $host =
$this->config->config_data['common']['host'];
+ $user =
$this->config->config_data['common']['user'];
+ $password =
$this->config->config_data['common']['password'];
// echo "connecting to $host with $user and $pass\n <br>";
$ftp = ftp_connect($host);
- if($ftp)
+ if($ftp)
{
- if (ftp_login($ftp,$user,$password))
+ if(ftp_login($ftp, $user, $password))
{
return $ftp;
}
}
}
- }
+ }
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11719] Merge 11715:11718 from trunk,
Sigurd Nes <=