$cnt = 0; $ave_sales = 0; $unit = $_POST['txtplateno']; $cust = $_POST['txtcust']; $where = "WHERE 1"; if (!empty($cust)) { $qrycustomer = "SELECT * FROM v_customer WHERE cust_id = '{$cust}'"; $rescustomer = $dbo->query($qrycustomer); foreach ($rescustomer as $rowcustomer) { $custname = $rowcustomer['custname']; } $where .= " AND customer_id = '{$cust}' "; } if (!empty($unit)) { $qryvehicle = new v_vehicleinfo(); $resvehicle = $dbo->query($qryvehicle->Query("WHERE vehicle_id = '{$unit}'")); foreach ($resvehicle as $rowvehicle) { $plateno = $rowvehicle['plate_no']; } $where .= " AND vehicle_id = '{$unit}' "; } $sql_spu_master = new v_salesperunit(); $qry_spu_master = mysql_query($sql_spu_master->Query($where)); $ln .= "SALES PER UNIT\r\n\r\n"; $ln .= "From: ," . $dtfrom . "\r\n"; $ln .= "To: ," . $dtto . "\r\n"; if (!empty($cust)) { $ln .= "Customer: ," . $custname . "\r\n"; } else { $ln .= "Customer: ,ALL\r\n"; }
<?php session_start(); $ses_id = session_id(); require_once "conf/db_connection.php"; require_once "functions.php"; $qrycust = " SELECT * FROM v_customer order by lastname"; $rescust = $dbo->query($qrycust); $qryunits = new v_vehicleinfo(); $resunits = $dbo->query($qryunits->Query("order by vehicle_id")); ?> <html> <head> <title></title> <link rel="stylesheet" type="text/css" href="style/cal.css" /> <link rel="stylesheet" type="text/css" href="style/forms.css" /> <?php require_once 'inc/datepicker.php'; ?> </head> <body> <p id="title">Sales per Unit Report</p> <form method="Post" onSubmit="return valMe();" action="sales_per_unit_report_result.php" target="_blank"> <div class="estimate_approval"> <table> <tr> <td width="150">Date</td> <td width="10" align="center">:</td> <td align="center" width="20">from</td> <td width="125"><input type="text" id="txtdatefrom" name="txtdatefrom" readonly class="date-pick" style="width: 100"></td>
session_start(); $ses_id = session_id(); require_once "conf/db_connection.php"; require_once "functions.php"; chkMenuAccess('estimate_add', $_SESSION['username'], 'estimate_list.php'); if (isset($_GET['customerid']) && !empty($_GET['customerid'])) { $customerid = $_GET['customerid']; $newVehicleLink = "?customerid=" . $_GET['customerid']; $qryplateno = new v_vehicleinfo(); $resplateno = $dbo->query($qryplateno->Query("WHERE customer_id = '{$customerid}'")); } else { if (isset($_GET['vehicleid']) && !empty($_GET['vehicleid'])) { $vehicleid = $_GET['vehicleid']; $qryplateno = new v_vehicleinfo(); $resplateno = $dbo->query($qryplateno->Query("WHERE vehicle_id = '{$vehicleid}'")); } else { $qry = new v_vehicleinfo(); $resplatenos = $dbo->query($qry->Query("order by plate_no")); } } $qry = " SELECT * FROM v_customer order by lastname"; $result = $dbo->query($qry); $qry1 = " SELECT * FROM v_customer order by lastname"; $result1 = $dbo->query($qry1); $qryjob = "SELECT * FROM v_job"; $resjob = $dbo->query($qryjob); $qryparts = "SELECT * FROM v_parts"; $resparts = $dbo->query($qryparts); $qrymaterial = "SELECT * FROM v_material"; $resmaterial = $dbo->query($qrymaterial);