function check_loged() { global $_SESSION; if (!isset($_SESSION["mfi_user"])) { die(wrapError(ERROR_CODE_EXPIRED, 'The Session has expired')); } }
<?php include_once '../function_header.php'; include '../common_server_functions.php'; //print_r($_REQUEST); $responseCode = 0; $driverId = $_REQUEST['driverId']; if ($driverId == 0 || $driverId == '') { die(wrapError(ERROR_CODE_FIVE, 'INTERNAL ERROR')); } $broker = $_REQUEST['broker']; if ($broker == 0 || $broker == '') { die(wrapFormError(ERROR_CODE_MISSING_PARAMETERS, 'Please select a broker', 'brokerId')); } $first = $_REQUEST['first']; if ($first == '') { die(wrapFormError(ERROR_CODE_MISSING_PARAMETERS, 'Please type the driver first name', 'firstName')); } $last = $_REQUEST['last']; if ($last == '') { die(wrapFormError(ERROR_CODE_MISSING_PARAMETERS, 'Please type the driver last name', 'lastName')); } $existingDriver = objectQuery($conexion, '*', 'driver', "driverFirstName like '{$first}' AND driverLastName like '{$last}' AND brokerId = '{$broker}' AND driverId<>'{$driverId}'"); if ($existingDriver != null) { die(wrapFormError(ERROR_CODE_DUPLICATE, "The driver name '{$first} {$last}' already exists with ID [" . $existingDriver['driverId'] . "]", 'firstName')); } $ssn = $_REQUEST['ssn']; if ($ssn == '') { die(wrapFormError(ERROR_CODE_MISSING_PARAMETERS, 'Please type the driver SSN', 'ssn')); } $tel = $_REQUEST['tel'];
<?php include_once '../function_header.php'; include '../common_server_functions.php'; //print_r($_REQUEST); $response = array(); $truck = $_REQUEST['truckId']; if ($truck == '') { die(wrapError(ERROR_CODE_FIVE, 'INTERNAL ERROR')); } if (getTruckTicketCount($conexion, $truck) > 0) { die(wrapError(ERROR_CODE_INVALID_VALUE, 'The truck you want to delete has assigned tickets. Please delete the tickets first.')); } //die(wrapError(-2,'Feature not ready')); $truckId = deleteTruck($conexion, $truck); mysql_close($conexion); echo wrapSubmitResponse(0, $truck);
<?php include_once '../function_header.php'; include '../common_server_functions.php'; //print_r($_REQUEST); $response = array(); $vendor = $_REQUEST['vendorId']; if ($vendor == '') { die(wrapError(ERROR_CODE_FIVE, 'INTERNAL ERROR')); } if (getVendorSupplierCount($conexion, $vendor) > 0) { die(wrapError(ERROR_CODE_INVALID_VALUE, 'The vendor you are trying to delete has assigned suppliers. Please delete the suppliers first.')); } //if(getBrokerTicketCount($conexion, $vendor) > 0) die(wrapError(ERROR_CODE_INVALID_VALUE, 'The vendor you want to delete has assigned tickets. Please delete the tickets first.')); //die(wrapError(-2,'Feature not ready')); $vendorId = deleteVendor($conexion, $vendor); mysql_close($conexion); echo wrapSubmitResponse(0, $vendorId);
include_once '../function_header.php'; include '../common_server_functions.php'; //print_r($_REQUEST); $response = array(); $report = $_REQUEST['reportId']; if ($report == '') { die(wrapError(ERROR_CODE_FIVE, 'INTERNAL ERROR')); } $number = $_REQUEST['number']; if ($number == '') { die(wrapError(ERROR_CODE_MISSING_PARAMETERS, 'Missing Check Number')); } if ($number != 'cash') { $existingNumber = objectQuery($conexion, '*', 'paidcheques', "paidchequeNumber = '{$number}'"); if ($existingNumber != null) { die(wrapError(ERROR_CODE_DUPLICATE, 'Number is used by a different check')); } } $date = $_REQUEST['date']; $amount = $_REQUEST['amount']; if ($amount <= 0) { die(wrapError(ERROR_CODE_INVALID_VALUE, 'The amount must be a value greater than "0".')); } //die(wrapError(-2,'Feature not ready')); $checkId = saveBrokerCheck($conexion, $report, $number, $amount, $date); if ($checkId != null && $checkId > 0) { echo wrapSubmitResponse(SUCCESS_CODE, $checkId); } else { echo wrapError(ERROR_CODE_INTERNAL_ERROR, 'There was an error inserting the check. Please contact the administrator.'); } mysql_close($conexion);
//print_r($_REQUEST); $response = array(); $optionalClause = ""; if ($_REQUEST['material'] != 0) { $optionalClause = "AND materialId = '" . $_REQUEST['material'] . "'"; } if ($_REQUEST['item'] != 0) { $optionalClause = "AND itemId = '" . $_REQUEST['item'] . "'"; } $project = $_REQUEST['project']; $start = $_REQUEST['startDate']; $end = $_REQUEST['endDate']; $comment = $_REQUEST['comment']; $availability = mysql_fetch_assoc(mysql_query("SELECT count(*) as totalTickets FROM ticket JOIN item USING (itemId) LEFT JOIN invoiceticket USING (ticketId) WHERE projectId = '{$project}' AND invoiceId IS NULL \n\tAND ticketDate BETWEEN '{$start}' AND '{$end}' {$optionalClause}", $conexion)); if ($availability['totalTickets'] == 0) { die(wrapError(-1, "There are no tickets in the specified dates")); } //die(wrapError(-2,'Feature not ready')); $queryInvoice = "INSERT INTO invoice (invoiceDate, projectId, invoiceStartDate, invoiceEndDate, invoiceComment) \n\tVALUES (CURDATE(),'{$project}','{$start}','{$end}','{$comment}')"; mysql_query($queryInvoice); $invoiceId = mysql_insert_id(); $queryTickets = "INSERT INTO invoiceticket (ticketId, invoiceId) SELECT ticketId, '{$invoiceId}' FROM ticket JOIN item USING (itemId) LEFT JOIN invoiceticket USING (ticketId) WHERE projectId = '{$project}' AND invoiceId IS NULL \n\tAND ticketDate BETWEEN '{$start}' AND '{$end}' {$optionalClause}"; mysql_query($queryTickets); /* $brokerId = $_REQUEST['brokerId']; $driverId = $_REQUEST['driverId']; if($_REQUEST['startDate'] == '') { $startDateQuery = "select ticketDate from ticket JOIN truck using (truckId) LEFT JOIN reportticket USING (ticketId) where reportId Is NULL AND brokerId = $brokerId ".($driverId!=0?" AND driverId = $driverId ORDER BY ticketDate asc limit 1":""); $startDateInfo = mysql_fetch_assoc(mysql_query($startDateQuery, $conexion)); $fromDate = $startDateInfo['ticketDate'];
<?php include_once '../function_header.php'; include '../common_server_functions.php'; //print_r($_REQUEST); $response = array(); $ticket = $_REQUEST['ticketId']; if ($ticket == '') { die(wrapError(ERROR_CODE_FIVE, 'INTERNAL ERROR')); } $inVendorInvoice = objectQuery($conexion, '*', 'supplierinvoiceticket JOIN supplierinvoice USING (supplierInvoiceId)', "ticketId = '{$ticketId}'"); if ($inVendorInvoice != null) { die(wrapError(ERROR_CODE_INVALID_VALUE, "This ticket is in vendor invoice [" . $inVendorInvoice['supplierInvoiceNumber'] . "]. Please delete the invoice first.")); } $inBrokerInvoice = objectQuery($conexion, '*', 'reportticket', "ticketId = '{$ticketId}'"); if ($inBrokerInvoice != null) { die(wrapError(ERROR_CODE_INVALID_VALUE, "This ticket is in broker invoice [" . $inBrokerInvoice['reportId'] . "]. Please delete the invoice first.")); } $inCustomerInvoice = objectQuery($conexion, '*', 'invoiceticket', "ticketId = '{$ticketId}'"); if ($inCustomerInvoice != null) { die(wrapError(ERROR_CODE_INVALID_VALUE, "This ticket is in customer invoice [" . $inVendorInvoice['invoiceId'] . "]. Please delete the invoice first.")); } //die(wrapError(-2,'Feature not ready')); $ticketId = deleteTicket($conexion, $ticket); mysql_close($conexion); echo wrapSubmitResponse(0, $ticketId);