| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hkosl.com/innoutstorage/webadmin/ |
Upload File : |
<?php
require_once('check_login.php');
$date_alert = 21;
$sql = "select id, rent_month, warehousing_date, customer_id, code, total_discounted_price from `order` where status = ? and deleted = ?";
$parameters = array("NEW", 0);
$order_info = bind_pdo($sql, $parameters, "selectall");
$non_created_rent_invoice = array();
foreach($order_info as $order){
for($i = 1; $i <= $order["rent_month"]; $i++){
$sql = "select inv.id from invoice inv INNER JOIN invoice_dtl inv_dtl where inv_dtl.invoice_id = inv.id and inv.order_id = ? and inv_dtl.type = ? and inv_dtl.month = ? and inv_dtl.deleted = ? and inv.deleted = ?";
$parameters = array($order["id"], "RENT", $i, 0, 0);
$result = bind_pdo($sql, $parameters, "selectone");
if(empty($result)){ //non-created rent invoice, alert admin to create this invoice
$date = new DateTime($order["warehousing_date"]);
$date->modify('+'.($i-1).' month');
$non_created_rent_invoice_duedate = $date->format("Y-m-d");
/*var_dump($non_created_rent_invoice_duedate);
var_dump(date('Y-m-d', strtotime($nowdate ." +".$date_alert." days")));*/
$date2 = new DateTime();
$date2->modify('+'.$date_alert.' day');
if($date2->format("Y-m-d") >= $non_created_rent_invoice_duedate){
$customer_info = get_customer($order["customer_id"]);
$customer_name = get_customer_name(rsa_crypt($customer_info["firstname"], 2), rsa_crypt($customer_info["lastname"], 2));
//$non_created_rent_invoice[] = array("order_id" => $order["id"], "month" => $i);
$non_created_rent_invoice[] = array(
"order_id" => $order["id"],
//"rent_month" => $i-1, //start from 0
"rent_month" => $i, //start from 1
"order_code" => $order["code"],
"customer_id" => $customer_info["id"],
"customer_code" => $customer_info["code"],
"customer_name" => $customer_name,
"invoice_duedate" => $non_created_rent_invoice_duedate,
"amount" => $order["total_discounted_price"],
"status" => "未建立"
);
}
}
}
}
//var_dump($non_created_rent_invoice);
?>
<!DOCTYPE html>
<html>
<head>
<?php require_once("html_head.php"); ?>
</head>
<body>
<table width="1200" height="600" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="200" align="left" valign="top">
<table width="200" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="70" align="left" valign="middle"> </td>
</tr>
<tr>
<td width="200" align="left" valign="top"><!-- Main Menu -->
<?php require("menu.php"); ?><!-- End Main Menu --></td>
</tr>
</table>
</td>
<td width="1000" align="left" valign="top">
<table width="1000" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<table width="1000" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="70" class="pagetitletxt"> </td>
<td width="50" align="center" class="icontxt">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="pagetitletxt">
<b><img src="images/iconList.jpg" width="48" height="48" align="absmiddle"/> 租金發票提示
</b></td>
</tr>
<tr>
<td height="25" align="left" valign="middle" class="msg"><?php if (isset($_GET["msg"])) echo $_GET['msg']; ?></td>
</tr>
<tr>
<td align="left" valign="middle">
<table width="1000" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10" class="listtitletxt"></td>
<td width="130" class="listtitletxt">合約編號</td>
<td width="130" class="listtitletxt">客戶編號</td>
<td width="150" class="listtitletxt">客戶姓名</td>
<td width="80" class="listtitletxt">發票到期</td>
<td width="100" class="listtitletxt">金額</td>
<td width="50" class="listtitletxt">狀態</td>
<td width="50" class="listtitletxt"></td>
</tr>
<?php
foreach ($non_created_rent_invoice as $invoice) {
print '<tr> <form action="invoice_add.php" method="post" name="modifyform" enctype="multipart/form-data" class="form_field">';
print "<input type='hidden' name='invoice_type' value='RENT'><input type='hidden' name='rent_month[".$invoice["rent_month"]."]' value='".$invoice["rent_month"]."'><input type='hidden' name='rent_amount[".$invoice["rent_month"]."]' value='".$invoice["amount"]."'><input type='hidden' name='rent_duedate[".$invoice["rent_month"]."]' value='".$invoice["invoice_duedate"]."'><input type='hidden' name='rent_remark[".$invoice["rent_month"]."]' value=''><input type='hidden' name='order_id' value='".$invoice["order_id"]."'>";
print "<td class='listtxt' style='padding-left:5'> </td>";
print "<td class='listtxt' style='padding-left:5'><a href='order_modifyform.php?order_id=" . $invoice["order_id"] . "' target='_blank'> " . $invoice{'order_code'} . "</a></td>";
print "<td class='listtxt' style='padding-left:5'><a href='customer_modifyform.php?id=" . $invoice["customer_id"] . "' target='_blank'> " . $invoice{'customer_code'} . "</a></td>";
print "<td class='listtxt' style='padding-left:5'><a href='customer_modifyform.php?id=" . $invoice["customer_id"] . "' target='_blank'>" . $invoice{'customer_name'} . "</a></td>";
print "<td class='listtxt' style='padding-left:5'>" . $invoice{'invoice_duedate'} . "</td>";
print "<td class='listtxt' style='padding-left:5'>$" . numberformat($invoice{'amount'}) . "</td>";
print "<td class='listtxt' style='padding-left:5'>" . $invoice["status"] . "</td>";
print "<td class='listtxt' style='padding-left:5'><button type='submit' >立即建立</button></td>";
print "</form></tr>";
}
?>
</table>
<br> <br> <br> <br>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>