Current File : /home/inlingua/www/crm.vprotectindia.com/cron/payment_update.php |
<?php error_reporting(E_ALL);
ini_set('display_errors', '1');
// Database connection
$conn = new mysqli("localhost", "inlingua_vprotect_user", "zDqxZh3sn65?vyjN", "inlingua_vprotect");
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$auth_token='VW8wsCIXRpmjMBusG42@^(87$8563zMHLQ2';
// Set header to XML
header("Content-Type: text/xml");
// Root element
echo "<?xml version='1.0' encoding='UTF-8'?>";
echo "<DATA_DS>";
$_REQUEST['token'];
if(isset($_REQUEST['token']) && $_REQUEST['token'] ==$auth_token){
$newdate=$_REQUEST['paymentdate'];
// Run query
$sql = "SELECT * FROM `customer_payments` where (trans_remarks='SUCCESS' or trans_remarks='Success-NA-0') and `payment_status`='1' and date(`updated_at`)= '$newdate'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// Output data
while($row = $result->fetch_assoc()) {
$invid=explode('@',$row['orderid']);
//print_r($invid);
//echo count($invid);
for($i=0; $i<count($invid); $i++){
//SELECT * FROM `outstanding_reports`
$id=$invid[$i];
if($id>0){
$sql = "SELECT * FROM `outstanding_reports` where `id`= '$id'";
$res = $conn->query($sql);
$row1 = $res->fetch_assoc();
echo "<G_1>";
if($row['bank_name']!=''){
$bank_name=$row['bank_name'];
}else {
$bank_name='N/A';
}
echo "<ORGANIZATION_ID>".$row1['organization_id']."</ORGANIZATION_ID>";
echo "<PARTY_NAME>".$row1['party_name']."</PARTY_NAME>";
echo "<BAL_FUNC_AMT>".$row1['bal_func_amt']."</BAL_FUNC_AMT>";
echo "<INVOICE_NUMBER>".$row1['invoice_number']."</INVOICE_NUMBER>";
echo "<INVOICE_AMOUNT>".$row1['invoice_amount']."</INVOICE_AMOUNT>";
echo "<CUSTOMER_NUMBER>".$row['asset_id']."</CUSTOMER_NUMBER>";
echo "<PAYMENT_TRX_ID>".$row['tran_number']."</PAYMENT_TRX_ID>";
echo "<PAYMENT_AMOUNT>".$row['amount']."</PAYMENT_AMOUNT>";
echo "<BANK_PAY_MODE>".$bank_name."</BANK_PAY_MODE>";
echo "<PAYMENT_DATE>".$row['updated_at']."</PAYMENT_DATE>";
echo "</G_1>";
}
}
}
} else {
echo "<message>No records found</message>";
}
}
else
{
echo "<message>auth failed</message>";
}
echo "</DATA_DS>";
$conn->close();
?>