function deleteCustomerCheck($handler, $checkId) { $check = mysql_fetch_assoc(mysql_query("SELECT * FROM receiptcheques WHERE receiptchequesId = '{$checkId}'", $handler)); mysql_query("DELETE FROM receiptcheques WHERE receiptchequesId = '{$checkId}'", $handler); if ($check['customerSuperCheckId'] != 0 && $check['customerSuperCheckId'] != null) { updateCredit($handler, $check['customerSuperCheckId']); } return $checkId; }
include "../commons.php"; include "../conexion.php"; ini_set('display_errors', 'Off'); ini_set('display_startup_errors', 'Off'); error_reporting(0); session_start(); $invoiceId = $_REQUEST['invoiceId']; $customerId = $_GET['customerId']; $projectId = $_GET['projectId']; $afterDate = $_GET['afterDate']; $beforeDate = $_GET['beforeDate']; $week = $_GET['week']; $paid = $_GET['paid']; $invoiceNum = $_GET['invoiceNum']; $superCheck = $_REQUEST['superCheckId']; $creditAmount = $_REQUEST['creditAmount']; $additionalParams = "?customerId={$customerId}&projectId={$projectId}&afterDate={$afterDate}&beforeDate={$beforeDate}&beforeEndDate={$beforeEndDate}&week{$week}=&paid={$paid}&invoiceNum={$invoiceNum}"; $superCheckInfo = mysql_fetch_assoc(mysql_query("select * from customer_super_check where customerSuperCheckId = {$superCheck}", $conexion)); $queryCustomer = "\ninsert into\n\treceiptcheques\n\t(\n\t\treceiptchequesDate,\n\t\tinvoiceId,\n\t\treceiptchequeNumber,\n\t\treceiptchequesAmount,\n\t\tcustomerSuperCheckId\n\t)\n\tvalues\n\t(\n\t\t'" . $superCheckInfo['customerSuperCheckDate'] . "',\n\t\t'" . mysql_real_escape_string($invoiceId) . "',\n\t\t'" . $superCheckInfo['customerSuperCheckNumber'] . "',\n\t\t'" . $creditAmount . "',\n\t\t{$superCheck}\n\t)"; mysql_query($queryCustomer, $conexion); updateCredit($superCheck, $conexion); //echo$queryCustomer; /* For Log Actions: 1 -> New (insert into) 2 -> Edit (update from) 3 -> Delete (delete from) */ //mysql_query($queryLog,$conexion); mysql_close($conexion); header("Location:reportInvoice.php" . $additionalParams);
<?php include "../commons.php"; include "../conexion.php"; ini_set('display_errors', 'Off'); ini_set('display_startup_errors', 'Off'); error_reporting(0); session_start(); $paidchequesId = $_REQUEST['i']; echo $paidchequesId; $creditInfo = mysql_fetch_assoc(mysql_query("select * from receiptcheques where receiptchequesId = {$paidchequesId}", $conexion)); mysql_query("delete from receiptcheques where receiptchequesId = {$paidchequesId}", $conexion); if ($creditInfo['customerSuperCheckId'] != null) { //super check updateCredit($creditInfo['customerSuperCheckId'], $conexion); } /* For Log Actions: 1 -> New (insert into) 2 -> Edit (update from) 3 -> Delete (delete from) */ //mysql_query($queryLog,$conexion); mysql_close($conexion);
//p_array($_SESSION); $invoiceId = $_REQUEST['invoiceId']; $amount = $_REQUEST['amount']; $customerSuperCheckId = $_REQUEST['superCheckId']; $superCheckInfo = mysql_fetch_assoc(mysql_query("select * from customer_super_check where customerSuperCheckId = $customerSuperCheckId", $conexion)); $invoiceInfo = mysql_fetch_assoc(mysql_query("select * from invoice JOIN project USING (projectId) where invoiceId = $invoiceId", $conexion)); $insertQuery = "insert into receiptcheques (receiptchequesDate, invoiceId, receiptchequesAmount, receiptchequeNumber, customerSuperCheckId) values ('".$superCheckInfo['customerSuperCheckDate']."', $invoiceId, $amount, '".$superCheckInfo['customerSuperCheckNumber']."', $customerSuperCheckId)"; mysql_query($insertQuery, $conexion); $receiptId = mysql_insert_id(); $newBalance = updateCredit($customerSuperCheckId, $conexion); $total = getInvoiceTotal($invoiceInfo['invoiceId'], $conexion); $paid = getInvoicePaid($invoiceInfo['invoiceId'], $conexion); $newRow = "<tr id='receipt$receiptId' receiptId='".$receiptId."'>"; $newRow.="<td>".$invoiceInfo['invoiceId']."</td>"; $newRow.="<td>".$invoiceInfo['projectName']."</td>"; $newRow.="<td>".decimalPad($invoiceInfo['invoiceDate'])."</td>"; $newRow.="<td>".decimalPad($total)."</td>"; $newRow.="<td>".decimalPad($paid - $amount)."</td>"; $newRow.="<td>".decimalPad($total - ($paid - $amount))."</td>"; $newRow.="<td class='sumable' >".decimalPad($amount)."</td>"; $newRow.="<td>".decimalPad($total - $paid)."</td>"; $newRow.="<td><img src='/trucking/img/118.png' width='20px' height='20px' class='removableInvoice' /></td>"; $newRow.="</tr>";