@@ -378,15 +378,21 @@ discard block |
||
| 378 | 378 | case 1: // Various Journal |
| 379 | 379 | if (isModEnabled('asset') && !getDolGlobalInt('ACCOUNTING_DISABLE_TRANSFER_ON_ASSETS')) { |
| 380 | 380 | $tmp = $this->getAssetData($user, $type, $date_start, $date_end, $in_bookkeeping); |
| 381 | - if (is_array($tmp)) $data = array_merge($data, $tmp); |
|
| 381 | + if (is_array($tmp)) { |
|
| 382 | + $data = array_merge($data, $tmp); |
|
| 383 | + } |
|
| 382 | 384 | } |
| 383 | 385 | if (isModEnabled('invoice') && !getDolGlobalInt('ACCOUNTING_DISABLE_TRANSFER_ON_DISCOUNTS')) { |
| 384 | 386 | $tmp = $this->getDiscountCustomer($user, $type, $date_start, $date_end, $in_bookkeeping); |
| 385 | - if (is_array($tmp)) $data = array_merge($data, $tmp); |
|
| 387 | + if (is_array($tmp)) { |
|
| 388 | + $data = array_merge($data, $tmp); |
|
| 389 | + } |
|
| 386 | 390 | } |
| 387 | 391 | if (isModEnabled('supplier_invoice') && !getDolGlobalInt('ACCOUNTING_DISABLE_TRANSFER_ON_DISCOUNTS')) { |
| 388 | 392 | $tmp = $this->getDiscountSupplier($user, $type, $date_start, $date_end, $in_bookkeeping); |
| 389 | - if (is_array($tmp)) $data = array_merge($data, $tmp); |
|
| 393 | + if (is_array($tmp)) { |
|
| 394 | + $data = array_merge($data, $tmp); |
|
| 395 | + } |
|
| 390 | 396 | } |
| 391 | 397 | break; |
| 392 | 398 | // case 2: // Sells Journal |
@@ -745,8 +751,12 @@ discard block |
||
| 745 | 751 | $langs->loadLangs(array('bills')); |
| 746 | 752 | |
| 747 | 753 | // Clean parameters |
| 748 | - if (empty($type)) $type = 'view'; |
|
| 749 | - if (empty($in_bookkeeping)) $in_bookkeeping = 'notyet'; |
|
| 754 | + if (empty($type)) { |
|
| 755 | + $type = 'view'; |
|
| 756 | + } |
|
| 757 | + if (empty($in_bookkeeping)) { |
|
| 758 | + $in_bookkeeping = 'notyet'; |
|
| 759 | + } |
|
| 750 | 760 | |
| 751 | 761 | // Build SQL - Customer invoices closed by discount |
| 752 | 762 | $sql = "SELECT f.rowid, f.ref, f.datef, f.fk_soc, f.total_ttc"; |
@@ -794,7 +804,9 @@ discard block |
||
| 794 | 804 | $acc_vat_coll_def = getDolGlobalString('ACCOUNTING_VAT_BUY_ACCOUNT'); // Normal to apply vat default account for buy with customer's discount |
| 795 | 805 | |
| 796 | 806 | while ($obj = $this->db->fetch_object($resql)) { |
| 797 | - if ($invoice_static->fetch((int) $obj->rowid) <= 0) continue; |
|
| 807 | + if ($invoice_static->fetch((int) $obj->rowid) <= 0) { |
|
| 808 | + continue; |
|
| 809 | + } |
|
| 798 | 810 | |
| 799 | 811 | $customer_static->fetch($invoice_static->socid); |
| 800 | 812 | $account_customer_general = !empty($customer_static->accountancy_code_customer_general) ? $customer_static->accountancy_code_customer_general : getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'); |
@@ -808,7 +820,9 @@ discard block |
||
| 808 | 820 | $useddep = (float) price2num($invoice_static->getSumDepositsUsed(), 'MT'); |
| 809 | 821 | $ttc_inv = (float) price2num($invoice_static->total_ttc, 'MT'); |
| 810 | 822 | $escompte_ttc = (float) price2num(max(0, $ttc_inv - $paid - $usedcn - $useddep), 'MT'); |
| 811 | - if ($escompte_ttc <= 0) continue; |
|
| 823 | + if ($escompte_ttc <= 0) { |
|
| 824 | + continue; |
|
| 825 | + } |
|
| 812 | 826 | |
| 813 | 827 | $bookkeeping_static = new BookKeeping($this->db); |
| 814 | 828 | $label_discount = $bookkeeping_static->accountingLabelForOperation($customer_static->getNomUrl(1, 'customer'), $invoice_static->ref, $langs->trans('DiscountGranted')); |
@@ -817,9 +831,13 @@ discard block |
||
| 817 | 831 | $ttcByRate = array(); $totalTTC = 0.0; |
| 818 | 832 | foreach ((array) $invoice_static->lines as $li) { |
| 819 | 833 | $ttc = (float) $li->total_ttc; |
| 820 | - if (!$ttc) continue; |
|
| 834 | + if (!$ttc) { |
|
| 835 | + continue; |
|
| 836 | + } |
|
| 821 | 837 | $key = number_format((float) $li->tva_tx, 3, '.', ''); |
| 822 | - if (!isset($ttcByRate[$key])) $ttcByRate[$key] = 0.0; |
|
| 838 | + if (!isset($ttcByRate[$key])) { |
|
| 839 | + $ttcByRate[$key] = 0.0; |
|
| 840 | + } |
|
| 823 | 841 | $ttcByRate[$key] += $ttc; |
| 824 | 842 | $totalTTC += $ttc; |
| 825 | 843 | } |
@@ -1035,8 +1053,12 @@ discard block |
||
| 1035 | 1053 | $langs->loadLangs(array('suppliers')); |
| 1036 | 1054 | |
| 1037 | 1055 | // Clean parameters |
| 1038 | - if (empty($type)) $type = 'view'; |
|
| 1039 | - if (empty($in_bookkeeping)) $in_bookkeeping = 'notyet'; |
|
| 1056 | + if (empty($type)) { |
|
| 1057 | + $type = 'view'; |
|
| 1058 | + } |
|
| 1059 | + if (empty($in_bookkeeping)) { |
|
| 1060 | + $in_bookkeeping = 'notyet'; |
|
| 1061 | + } |
|
| 1040 | 1062 | |
| 1041 | 1063 | // SQL - Supplier invoices closed by discount |
| 1042 | 1064 | $sql = "SELECT ff.rowid, ff.ref, ff.datef, ff.fk_soc, ff.total_ttc"; |
@@ -1084,7 +1106,9 @@ discard block |
||
| 1084 | 1106 | $acc_vat_ded_def = getDolGlobalString('ACCOUNTING_VAT_SOLD_ACCOUNT'); // Normal to apply vat default account for sold with supplier's discount |
| 1085 | 1107 | |
| 1086 | 1108 | while ($obj = $this->db->fetch_object($resql)) { |
| 1087 | - if ($invoicesupplier_static->fetch((int) $obj->rowid) <= 0) continue; |
|
| 1109 | + if ($invoicesupplier_static->fetch((int) $obj->rowid) <= 0) { |
|
| 1110 | + continue; |
|
| 1111 | + } |
|
| 1088 | 1112 | |
| 1089 | 1113 | $supplier_static->fetch($invoicesupplier_static->socid); |
| 1090 | 1114 | $account_supplier_general = !empty($supplier_static->accountancy_code_supplier_general) ? $supplier_static->accountancy_code_supplier_general : getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'); |
@@ -1098,7 +1122,9 @@ discard block |
||
| 1098 | 1122 | $useddep = (float) price2num($invoicesupplier_static->getSumDepositsUsed(), 'MT'); |
| 1099 | 1123 | $ttc_inv = (float) price2num($invoicesupplier_static->total_ttc, 'MT'); |
| 1100 | 1124 | $escompte_ttc = (float) price2num(max(0, $ttc_inv - $paid - $usedcn - $useddep), 'MT'); |
| 1101 | - if ($escompte_ttc <= 0) continue; |
|
| 1125 | + if ($escompte_ttc <= 0) { |
|
| 1126 | + continue; |
|
| 1127 | + } |
|
| 1102 | 1128 | |
| 1103 | 1129 | $bookkeeping_static = new BookKeeping($this->db); |
| 1104 | 1130 | $label_discount = $bookkeeping_static->accountingLabelForOperation($supplier_static->getNomUrl(1, 'supplier'), $invoicesupplier_static->ref, $langs->trans('DiscountReceived')); |
@@ -1107,9 +1133,13 @@ discard block |
||
| 1107 | 1133 | $ttcByRate = array(); $totalTTC = 0.0; |
| 1108 | 1134 | foreach ((array) $invoicesupplier_static->lines as $li) { |
| 1109 | 1135 | $ttc = (float) $li->total_ttc; |
| 1110 | - if (!$ttc) continue; |
|
| 1136 | + if (!$ttc) { |
|
| 1137 | + continue; |
|
| 1138 | + } |
|
| 1111 | 1139 | $key = number_format((float) $li->tva_tx, 3, '.', ''); |
| 1112 | - if (!isset($ttcByRate[$key])) $ttcByRate[$key] = 0.0; |
|
| 1140 | + if (!isset($ttcByRate[$key])) { |
|
| 1141 | + $ttcByRate[$key] = 0.0; |
|
| 1142 | + } |
|
| 1113 | 1143 | $ttcByRate[$key] += $ttc; |
| 1114 | 1144 | $totalTTC += $ttc; |
| 1115 | 1145 | } |
@@ -1273,9 +1303,11 @@ discard block |
||
| 1273 | 1303 | } |
| 1274 | 1304 | } else { |
| 1275 | 1305 | // si TVA = 0, pousser les 2 lignes view/bookkeeping déjà constituées |
| 1276 | - if ($type == 'view') $element['blocks'][] = $lines_view; |
|
| 1277 | - elseif ($type == 'bookkeeping') $element['blocks'][] = $lines_book; |
|
| 1278 | - else { // csv |
|
| 1306 | + if ($type == 'view') { |
|
| 1307 | + $element['blocks'][] = $lines_view; |
|
| 1308 | + } elseif ($type == 'bookkeeping') { |
|
| 1309 | + $element['blocks'][] = $lines_book; |
|
| 1310 | + } else { // csv |
|
| 1279 | 1311 | $element['blocks'][] = array($docdate, $invoicesupplier_static->ref, length_accountg($account_supplier_general), $label_discount.' - '.$langs->transnoentitiesnoconv('Supplier'), price($ttc_part), ''); |
| 1280 | 1312 | $element['blocks'][] = array($docdate, $invoicesupplier_static->ref, length_accountg($acc_disc_recv), $label_discount.' ('.$rateStr.'%)', '', price($ht_part)); |
| 1281 | 1313 | } |