diff --git a/wms/account-receivable-maintainance-index.php b/wms/account-receivable-maintainance-index.php index aad21f66..f9e6430a 100644 --- a/wms/account-receivable-maintainance-index.php +++ b/wms/account-receivable-maintainance-index.php @@ -136,7 +136,6 @@ for ($i = 0; $i < count($rows); $i++) { $tmpname = $row['ProjectId'] . $row['RowCode']; $data[$tmpname] = $row; $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'; $datahavetopay = strtotime($row['CU_EstPayDate']) > $today ? 0 : 1; $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']; $RowCode = $row['RowCode']; $BillNo = $row['BillNo']; - $data[$tmpname]['receivable_date'] = date('Y-m-d', strtotime($row['CU_EstPayDate'])); - $budget = $row['OAmountWithTax']; + $data[$tmpname]['receivable_date'] = (is_null($row['CU_EstPayDate'])) ? null : date('Y-m-d', strtotime($row['CU_EstPayDate'])); + $receivable_date = (is_null($data[$tmpname]['receivable_date'])) ? null : $data[$tmpname]['receivable_date']; + $budget = (is_null($row['OAmountWithTax'])) ? 0 : $row['OAmountWithTax']; $invoiceNo = $row['InvoiceNo']; $tableinvoice_state = is_null($invoiceNo) ? 0 : 1; $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; $table1 = "INSERT INTO account_receivable_maintainance( `contract_no`, `facility_no`, `RowCode`, `BillNo`, - `receivable_date`, `budget`, `receivable`, `invoice_state`, @@ -176,25 +175,27 @@ for ($i = 0; $i < count($rows); $i++) { '$facility_no', '$RowCode', '$BillNo', - '$receivable_date', $budget, $datahavetopay, $tableinvoice_state, $invoice_budget, $table_writeoff "; + $table1 .= is_null($receivable_date) ? "" : ",`receivable_date`"; + $table2 .= is_null($receivable_date) ? "" : ",'$receivable_date'"; $table1 .= is_null($invoicedate) ? "" : ",`invoice_date`"; $table2 .= is_null($invoicedate) ? "" : ",'$invoicedate'"; $table1 .= is_null($invoiceNo) ? "" : ",`invoice_no`"; $table2 .= is_null($invoiceNo) ? "" : ",'$invoiceNo'"; $table .= $table1 . $table2 . "); \n"; } -// $file_path = 'account_receivable_maintainance_sql.sql'; -// if (file_put_contents($file_path, $table) !== false) { -// echo "SQL文件已成功生成:{$file_path}"; -// } else { -// echo "生成SQL文件时出现错误。"; -// } + +$file_path = 'account_receivable_maintainance_sql.sql'; +if (file_put_contents($file_path, $table) !== false) { + echo "SQL文件已成功生成:{$file_path}"; +}else{ + "fail"; +} // foreach ($data as $key => $row) { // echo $key . "
"; diff --git a/wms/account-receivable-new-index.php b/wms/account-receivable-new-index.php index e2ac10a8..10cd6a82 100644 --- a/wms/account-receivable-new-index.php +++ b/wms/account-receivable-new-index.php @@ -338,6 +338,10 @@ $sign0 = array('簽約', '簽訂', '合約簽訂', '訂金'); $arrival = array('貨抵工地', '貨底工地', '工地動工'); $final6 = array('核可函取得後6個月', '得合格函後6個月'); + + + + foreach ($PayStage_array as $key => &$value) { foreach ($value as $paykey => &$payvalue) { if (isset($wip_array[$payvalue['facilityno']])) { diff --git a/wms/account-receivable-test.php b/wms/account-receivable-test.php index 2c28e510..d9e447c7 100644 --- a/wms/account-receivable-test.php +++ b/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'] ."
"; // } - -$TIME = strtotime('2000-12-02'); - -echo $TIME; \ No newline at end of file +$sql = "SELECT salOrderStagePay.BillNo, salOrderStagePay.PayStage FROM salOrderStagePay LEFT JOIN salSalesOrder ON salSalesOrder.BillNo = salOrderStagePay.BillNo WHERE salSalesOrder.ModeId = 'M' +ORDER BY salOrderStagePay.BillNo, salOrderStagePay.PayStage"; +$query = mysqli_query($link, $sql);