$ln .= "Payment Type: ,ALL\r\n"; } $ln .= "\r\nCustomer Name,Service Availed,Payment Type,Labor,Lubricants,Sublet/Others,Spare Parts,VAT,Discount,Total\r\n"; $cnt = 1; while ($row = mysql_fetch_array($qry_lbs_master)) { $grandtotal = $row['labor'] + $row['lubricants'] + $row['sublet'] + $row['parts']; $discounted = $grandtotal - $row['discount']; if ($row['senior_citizen'] == 0) { $vat = $discounted * 0.12; } else { $vat = $discounted * 0.0; } // $discounted = ($grandtotal - $row['discount']); $totalamnt = $discounted + $vat; $jobs = null; $sql_lbs_detail = new v_service_detail_job(); $qry_lbs_detail = mysql_query($sql_lbs_detail->Query("WHERE estimate_refno = '{$row['estimate_refno']}'")); while ($row_lbs_detail = mysql_fetch_array($qry_lbs_detail)) { $job[] = $row_lbs_detail['job_name']; } for ($i = 0; $i < count($job); $i++) { if ($i > 0) { $jobs .= ","; } $jobs .= $job[$i]; } $ln .= $row['customername'] . "," . $jobs . "," . $row['payment_mode'] . "," . $row['labor'] . "," . $row['lubricants'] . "," . $row['sublet'] . "," . $row['parts'] . "," . number_format($vat, 2, ".", "") . "," . $row['discount'] . "," . number_format($totalamnt, 2, ".", "") . "\r\n"; $totallabor += $row['labor']; $totallubricants += $row['lubricants']; $totalsublet += $row['sublet']; $totalparts += $row['parts'];
$empname = $rowestimate['tech_name']; $promisetime = $rowestimate['promise_time']; $promisedate = $rowestimate['promise_date']; $plateno = $rowestimate['plate_no']; $makedesc = $rowestimate['make_desc']; $yeardesc = $rowestimate['year_desc']; $modeldesc = $rowestimate['model_desc']; $colordesc = $rowestimate['color_desc']; $variant = $rowestimate['variant']; $engineno = $rowestimate['engine_no']; $chassisno = $rowestimate['chassis_no']; $serialno = $rowestimate['serial_no']; } $qrycost_accessory = new v_service_detail_accessory(); $rescost_accessory = $dbo->query($qrycost_accessory->Query("WHERE estimate_refno = '{$estimaterefno}'")); $qrycost_job = new v_service_detail_job(); $rescost_job = $dbo->query($qrycost_job->Query("WHERE estimate_refno = '{$estimaterefno}'")); $qrycost_material = new v_service_detail_material(); $rescost_material = $dbo->query($qrycost_material->Query("WHERE estimate_refno = '{$estimaterefno}'")); $qrycost_parts = new v_service_detail_parts(); $rescost_parts = $dbo->query($qrycost_parts->Query("WHERE estimate_refno = '{$estimaterefno}'")); $subtotal = 0; if (isset($_POST['savewo']) && !empty($_POST['savewo']) && $_POST['savewo'] == 1) { $empid = $_POST['empid']; $promisetime = $_POST['promisetime']; $promisedate = dateFormat($_POST['promisedate'], "Y-m-d"); $paymentmode = $_POST['paymentmode']; $qry = null; $qry .= "UPDATE tbl_service_master SET payment_id = '{$paymentmode}', technician = '{$empid}',promise_date = '{$promisedate}',promise_time = '{$promisetime}' WHERE estimate_refno = '{$estimaterefno}'; "; $qry .= "INSERT INTO tbl_jobclock_master(wo_refno) VALUE('{$worefno}'); "; $res = $dbo->query($qry);
<?php session_start(); $ses_id = session_id(); require_once "conf/db_connection.php"; require_once "functions.php"; $estimaterefno = $_GET['estimaterefno']; $qryestimate = new v_service_master(); $resestimate = $dbo->query($qryestimate->Query("WHERE tbl_service_master.estimate_refno = '{$estimaterefno}'")); $qrytempjob = new v_service_detail_job(); $restempjob = $dbo->query($qrytempjob->Query("WHERE estimate_refno = '{$estimaterefno}'")); $qrytempparts = new v_service_detail_parts(); $restempparts = $dbo->query($qrytempparts->Query("WHERE estimate_refno = '{$estimaterefno}'")); $numparts = count($restempparts); $qrytempaccessory = new v_service_detail_accessory(); $restempaccessory = $dbo->query($qrytempaccessory->Query("WHERE estimate_refno = '{$estimaterefno}'")); $numlubricant = count($restempaccessory); $qrytempmaterial = new v_service_detail_material(); $restempmaterial = $dbo->query($qrytempmaterial->Query("WHERE estimate_refno = '{$estimaterefno}'")); $nummaterial = count($restempmaterial); foreach ($resestimate as $rowestimate) { $custid = $rowestimate['customer_id']; $custname = $rowestimate['customername']; $address = $rowestimate['cust_address']; $vehicleid = $rowestimate['vehicle_id']; $odometer = $rowestimate['odometer']; $remarks = $rowestimate['remarks']; $paymentmode = $rowestimate['payment_mode']; $discount = $rowestimate['discount']; $worefno = $rowestimate['wo_refno']; $transstatus = $rowestimate['trans_status'];