Browse Source

應收帳款 維修

main
Ellin 1 year ago
parent
commit
ff0b9ccb82
  1. 25
      wms/account-receivable-maintainance-index.php
  2. 4
      wms/account-receivable-new-index.php
  3. 7
      wms/account-receivable-test.php

25
wms/account-receivable-maintainance-index.php

@ -136,7 +136,6 @@ for ($i = 0; $i < count($rows); $i++) {
$tmpname = $row['ProjectId'] . $row['RowCode']; $tmpname = $row['ProjectId'] . $row['RowCode'];
$data[$tmpname] = $row; $data[$tmpname] = $row;
$data[$tmpname]['CU_EstPayDate'] = date('Y-m-d', strtotime($row['CU_EstPayDate'])); $data[$tmpname]['CU_EstPayDate'] = date('Y-m-d', strtotime($row['CU_EstPayDate']));
$receivable_date = $data[$tmpname]['CU_EstPayDate'];
$data[$tmpname]['havetopay'] = strtotime($row['CU_EstPayDate']) > $today ? '--' : 'V'; $data[$tmpname]['havetopay'] = strtotime($row['CU_EstPayDate']) > $today ? '--' : 'V';
$datahavetopay = strtotime($row['CU_EstPayDate']) > $today ? 0 : 1; $datahavetopay = strtotime($row['CU_EstPayDate']) > $today ? 0 : 1;
$data[$tmpname]['collecttime'] = collect_month(strtotime($row['CU_EstPayDate'])); $data[$tmpname]['collecttime'] = collect_month(strtotime($row['CU_EstPayDate']));
@ -152,19 +151,19 @@ for ($i = 0; $i < count($rows); $i++) {
$facility_no = $row['CU_MaterialId']; $facility_no = $row['CU_MaterialId'];
$RowCode = $row['RowCode']; $RowCode = $row['RowCode'];
$BillNo = $row['BillNo']; $BillNo = $row['BillNo'];
$data[$tmpname]['receivable_date'] = date('Y-m-d', strtotime($row['CU_EstPayDate'])); $data[$tmpname]['receivable_date'] = (is_null($row['CU_EstPayDate'])) ? null : date('Y-m-d', strtotime($row['CU_EstPayDate']));
$budget = $row['OAmountWithTax']; $receivable_date = (is_null($data[$tmpname]['receivable_date'])) ? null : $data[$tmpname]['receivable_date'];
$budget = (is_null($row['OAmountWithTax'])) ? 0 : $row['OAmountWithTax'];
$invoiceNo = $row['InvoiceNo']; $invoiceNo = $row['InvoiceNo'];
$tableinvoice_state = is_null($invoiceNo) ? 0 : 1; $tableinvoice_state = is_null($invoiceNo) ? 0 : 1;
$data[$tmpname]['invoice_budget'] = is_null($row['InvoiceOAmount']) ? 0 : $row['InvoiceOAmount']; $data[$tmpname]['invoice_budget'] = is_null($row['InvoiceOAmount']) ? 0 : $row['InvoiceOAmount'];
$invoice_budget = $data[$tmpname]['invoice_budget']; $invoice_budget = (is_null($data[$tmpname]['invoice_budget'])) ? 0 : $data[$tmpname]['invoice_budget'];
$table_writeoff = ($data[$tmpname]['WriteOff'] =='V') ? 1 : 0; $table_writeoff = ($data[$tmpname]['WriteOff'] =='V') ? 1 : 0;
$table1 = "INSERT INTO account_receivable_maintainance( $table1 = "INSERT INTO account_receivable_maintainance(
`contract_no`, `contract_no`,
`facility_no`, `facility_no`,
`RowCode`, `RowCode`,
`BillNo`, `BillNo`,
`receivable_date`,
`budget`, `budget`,
`receivable`, `receivable`,
`invoice_state`, `invoice_state`,
@ -176,25 +175,27 @@ for ($i = 0; $i < count($rows); $i++) {
'$facility_no', '$facility_no',
'$RowCode', '$RowCode',
'$BillNo', '$BillNo',
'$receivable_date',
$budget, $budget,
$datahavetopay, $datahavetopay,
$tableinvoice_state, $tableinvoice_state,
$invoice_budget, $invoice_budget,
$table_writeoff $table_writeoff
"; ";
$table1 .= is_null($receivable_date) ? "" : ",`receivable_date`";
$table2 .= is_null($receivable_date) ? "" : ",'$receivable_date'";
$table1 .= is_null($invoicedate) ? "" : ",`invoice_date`"; $table1 .= is_null($invoicedate) ? "" : ",`invoice_date`";
$table2 .= is_null($invoicedate) ? "" : ",'$invoicedate'"; $table2 .= is_null($invoicedate) ? "" : ",'$invoicedate'";
$table1 .= is_null($invoiceNo) ? "" : ",`invoice_no`"; $table1 .= is_null($invoiceNo) ? "" : ",`invoice_no`";
$table2 .= is_null($invoiceNo) ? "" : ",'$invoiceNo'"; $table2 .= is_null($invoiceNo) ? "" : ",'$invoiceNo'";
$table .= $table1 . $table2 . "); \n"; $table .= $table1 . $table2 . "); \n";
} }
// $file_path = 'account_receivable_maintainance_sql.sql';
// if (file_put_contents($file_path, $table) !== false) { $file_path = 'account_receivable_maintainance_sql.sql';
// echo "SQL文件已成功生成:{$file_path}"; if (file_put_contents($file_path, $table) !== false) {
// } else { echo "SQL文件已成功生成:{$file_path}";
// echo "生成SQL文件时出现错误。"; }else{
// } "fail";
}
// foreach ($data as $key => $row) { // foreach ($data as $key => $row) {
// echo $key . "<br>"; // echo $key . "<br>";

4
wms/account-receivable-new-index.php

@ -338,6 +338,10 @@ $sign0 = array('簽約', '簽訂', '合約簽訂', '訂金');
$arrival = array('貨抵工地', '貨底工地', '工地動工'); $arrival = array('貨抵工地', '貨底工地', '工地動工');
$final6 = array('核可函取得後6個月', '得合格函後6個月'); $final6 = array('核可函取得後6個月', '得合格函後6個月');
foreach ($PayStage_array as $key => &$value) { foreach ($PayStage_array as $key => &$value) {
foreach ($value as $paykey => &$payvalue) { foreach ($value as $paykey => &$payvalue) {
if (isset($wip_array[$payvalue['facilityno']])) { if (isset($wip_array[$payvalue['facilityno']])) {

7
wms/account-receivable-test.php

@ -441,7 +441,6 @@ $P_all = "
// echo $value['BillNo'] . ";" . $mode . ";" . $value['BizPartnerId'] .";".$value['BizPartnerName'].";".$value['ProjectId']. ";".$value['CU_MaterialId']. ";".$value['DispBillNo'].";" . $value['DispBillDate'] ."<br>"; // echo $value['BillNo'] . ";" . $mode . ";" . $value['BizPartnerId'] .";".$value['BizPartnerName'].";".$value['ProjectId']. ";".$value['CU_MaterialId']. ";".$value['DispBillNo'].";" . $value['DispBillDate'] ."<br>";
// } // }
$sql = "SELECT salOrderStagePay.BillNo, salOrderStagePay.PayStage FROM salOrderStagePay LEFT JOIN salSalesOrder ON salSalesOrder.BillNo = salOrderStagePay.BillNo WHERE salSalesOrder.ModeId = 'M'
$TIME = strtotime('2000-12-02'); ORDER BY salOrderStagePay.BillNo, salOrderStagePay.PayStage";
$query = mysqli_query($link, $sql);
echo $TIME;

Loading…
Cancel
Save