$appln_type = clean_arr($_POST['appln_type']); $surveyed_date = clean_arr($_POST['surveyed_date']); $engeneer_appr = clean_arr($_POST['engeneer_appr']); $approved_date = clean_arr($_POST['approved_date']); $inspected_by = clean_arr($_POST['inspected_by']); $premise_nature = clean_arr($_POST['premise_nature']); $service_nature = clean_arr($_POST['service_nature']); $appnt_type = clean_arr($_POST['appnt_type']); $appnt_fullname = clean_arr($_POST['appnt_fullname']); $occupants = clean_arr($_POST['occupants']); $appnt_tel = clean_arr($_POST['appnt_tel']); $appnt_post_addr = clean_arr($_POST['appnt_post_addr']); $appnt_phy_addr = clean_arr($_POST['appnt_phy_addr']); $block_no = clean_arr($_POST['block_no']); $plot_no = clean_arr($_POST['plot_no']); $living_area = clean_arr($_POST['living_area']); $living_town = clean_arr($_POST['living_town']); $appln_no = count($appln_id); for ($i = 0; $i < $appln_no; $i++) { $query_appln = "UPDATE application\r\n SET appln_id = '{$appln_id[$i]}]',\r\n appln_date = '{$appln_date[$i]}',\r\n appln_type = '{$appln_type[$i]}',\r\n surveyed_date = '{$surveyed_date[$i]}',\r\n engeneer_appr = '{$engeneer_appr[$i]}',\r\n approved_date = '{$approved_date[$i]}',\r\n inspected_by = '{$inspected_by[$i]}',\r\n premise_nature = '{$premise_nature[$i]}'\r\n WHERE appln_id = '{$appln_id[$i]}'"; $result_appln = mysql_query($query_appln) or die(mysql_error()); $query_appnt = "UPDATE applicant\r\n SET appnt_type_id = '{$appnt_type[$i]}',\r\n appnt_fullname = '{$appnt_fullname[$i]}',\r\n occupants = '{$occupants[$i]}',\r\n appnt_tel = '{$appnt_tel[$i]}',\r\n appnt_post_addr = '{$appnt_post_addr[$i]}',\r\n appnt_phy_addr = '{$appnt_phy_addr[$i]}',\r\n block_no = '{$block_no[$i]}',\r\n plot_no = '{$plot_no[$i]}',\r\n living_area = '{$living_area[$i]}',\r\n living_town = '{$living_town[$i]}',\r\n ba_id = '{$ba_id[$i]}'\r\n WHERE appnt_id = '{$appnt_id[$i]}'"; $result_appnt = mysql_query($query_appnt) or die(mysql_error()); } if ($result_appnt && $result_appln && $result_appnt) { info('message', 'Updated successfully!'); header('Location: applications.php'); } else { info('error', 'Cannot save, Please try again.'); header('Location: applications.php'); }
<?php error_reporting(E_ALL ^ (E_NOTICE | E_WARNING)); require '../../includes/session_validator.php'; require_once '../../config/config.php'; require_once '../../functions/general_functions.php'; $supplierID = clean($_GET['supplierID']); $itemID = clean_arr($_GET['itemID']); $orderQnty = clean_arr($_GET['orderQnty']); $itemCost = clean_arr($_GET['itemCost']); $amountPayed = clean($_GET['amountPayed']); if (isset($supplierID) && !empty($supplierID) && isset($itemID[0]) && !empty($itemID[0]) && isset($orderQnty[0]) && !empty($orderQnty[0]) && isset($itemCost[0]) && !empty($itemCost[0])) { $query_company = "SELECT `companyName`, `companyAddress`, `companyPhone`,\r\n `companyFax`, `companyEmail`, `companyWebsite`,\r\n `companyLogo`\r\n FROM company"; $result_company = mysqli_query($link, $query_company) or die(mysqli_error($link)); $company = mysqli_fetch_array($result_company); $query_supplier = "SELECT `supplierName`, `supplierAddress`, `supplierPhone`,\r\n `supplierFax`, `supplierEmail`\r\n FROM supplier\r\n WHERE `supplierID` = '{$supplierID}'"; $result_supplier = mysqli_query($link, $query_supplier) or die(mysqli_error($link)); $supplier = mysqli_fetch_array($result_supplier); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>inWare | PURCHASE ORDER PREVIEW</title> <link href="../../css/pop-up.css" rel="stylesheet" /> <link href="../../css/tooltip.css" rel="stylesheet" /> <link href="../../css/print.css" rel="stylesheet" /> <link href="../../css/layout.css" rel="stylesheet" />
<?php require '../../includes/session_validator.php'; require '../../config/config.php'; require '../../functions/general_functions.php'; $unitMeasureID = $_POST['unitMeasureID']; $unitName = clean_arr($_POST['unitName']); $uri = $_POST['url']; for ($i = 0; $i < count($unitName); $i++) { $query_itemUnit = "UPDATE itemunitmeasure\r\n SET unit = '{$unitName[$i]}'\r\n WHERE `unitMeasureID` = '{$unitMeasureID[$i]}'"; $result_itemUnit = mysqli_query($link, $query_itemUnit) or die(mysqli_error($link)); $query_insert_unit = "INSERT IGNORE INTO itemunitmeasure\r\n (`unitMeasureID`, unit)\r\n VALUES ('{$unitMeasureID[$i]}','{$unitName[$i]}')"; $result_insert_unit = mysqli_query($link, $query_insert_unit); } if ($result_itemUnit || $result_insert_unit) { info('message', 'Item unit(s) updated successfully!'); } else { info('error', 'Cannot update item unit(s), Please try again!'); }
$metthaz = clean_arr($_POST['metthaz']); $still = clean_arr($_POST['still']); $org_name = strtoupper($org_name); $phy_address = strtoupper($phy_address); $post_address = strtoupper($post_address); $n = count($person_name); $query_organisation = "UPDATE tblgenorganisations\r\n SET `OrganisationName` = '{$org_name}',\r\n `OrganisationCategoryID` = '{$org_cat}',\r\n `PhysicalAddress` = '{$phy_address}',\r\n `PostalAddress` = '{$post_address}',\r\n `Phone` = '{$org_phone}',\r\n `Fax` = '{$org_fax}',\r\n `Email` = '{$org_email}',\r\n `ZHAPMoSFocalPersonID` = '{$hiv_focal['0']}',\r\n `HIVFocalPersonID` = '{$hiv_focal['1']}', \r\n `StartedOperating` = '{$org_start_date}'\r\n WHERE `OrganisationCode` = '{$org_code}'"; $result_organisation = mysql_query($query_organisation) or die(mysql_error()); for ($i = 0; $i < $n; $i++) { $query_persons = "UPDATE tblgenorganisationpeople\r\n SET `FullName` = '{$person_name[$i]}',\r\n `Designation` = '{$designation[$i]}',\r\n `Phone` = '{$person_phone[$i]}',\r\n `Fax` = '{$person_fax[$i]}',\r\n `Email` = '{$person_email[$i]}',\r\n `METTHAZ` = '{$metthaz[$i]}',\r\n `StillAtOrganisation` = '{$still[$i]}'\r\n WHERE `OrganisationPersonID` = '{$person_code[$i]}'"; $result_persons = mysql_query($query_persons) or die(mysql_error()); } for ($i = 0; $i < $n; $i++) { $query_persons = "INSERT IGNORE INTO tblgenorganisationpeople\r\n (`OrganisationPersonID`, `OrganisationCode`, `FullName`, `Designation`,\r\n `Phone`, `Fax`, `Email`, `METTHAZ`, `StillAtOrganisation`)\r\n VALUES ('{$person_code[$i]}', '{$org_code}', '{$person_name[$i]}', '{$designation[$i]}',\r\n '{$person_phone[$i]}', '{$person_fax[$i]}', '{$person_email[$i]}', '{$metthaz[$i]}', '{$still[$i]}')"; $result_persons = mysql_query($query_persons) or die(mysql_error()); } foreach (clean_arr($_POST['umbrella']) as $umbrella) { $query_umbrella = "UPDATE tblgenorganisationsumbrella\r\n SET `UmbrellaOrganisationCode` = '{$umbrella}'\r\n WHERE `OrganisationCode` = '{$org_code}'"; $result_umbrella = mysql_query($query_umbrella) or die(mysql_error()); } foreach (clean_arr($_POST['umbrella']) as $umbrella) { $query_umbrella = "INSERT IGNORE INTO tblgenorganisationsumbrella\r\n (`OrganisationCode`, `UmbrellaOrganisationCode`)\r\n VALUES ('{$org_code}', '{$umbrella}')"; $result_umbrella = mysql_query($query_umbrella) or die(mysql_error()); } if ($result_organisation) { info('message', "Organisation updated successfully!"); header("Location: edit_organisation.php?org_id=" . $org_code); } else { info('error', 'Cannot update organisation. Please try again!'); header("Location: edit_organisation.php?org_id=" . $org_code); }
<?php require_once '../../includes/session_validator.php'; require_once '../../config/config.php'; require_once '../../functions/general_functions.php'; $graph_lines = clean_arr($_POST['lines']); $selected_date = clean($_POST['dateRange']); $graph_data = array(); $group_by = clean($_POST['groupBy']); $dateFrom = clean($_POST['dateFrom']); $dateTo = clean($_POST['dateTo']); $thisMonth = date('Ym'); switch ($group_by) { case 'days': $column = 'calender_date'; $alias_column = $column; $group_by = ' GROUP BY calender_date'; break; case 'weeks': $column = 'YEARWEEK(calender_date, 1)'; $alias_column = 'YEARWEEK(calender_date, 1) AS calender_date'; $group_by = ' GROUP BY YEARWEEK(calender_date, 1)'; break; case 'months': $column = 'EXTRACT(YEAR_MONTH FROM calender_date)'; $alias_column = 'EXTRACT(YEAR_MONTH FROM calender_date) AS calender_date'; $group_by = ' GROUP BY EXTRACT(YEAR_MONTH FROM calender_date)'; break; case 'quarters': $column = 'CONCAT(QUARTER(calender_date),YEAR(calender_date))'; $alias_column = 'CONCAT(QUARTER(calender_date),YEAR(calender_date)) AS calender_date';
<?php require '../../includes/session_validator.php'; require '../../config/config.php'; require '../../functions/general_functions.php'; session_start(); $url = $_SESSION['url']; session_commit(); $taxID = $_POST['taxID']; $taxName = clean_arr($_POST['taxName']); $taxRate = clean_arr($_POST['taxRate']); $uri = $_POST['url']; for ($i = 0; $i < count($taxName); $i++) { $query_itemTax = "UPDATE tax\r\n SET `taxName` = '{$taxName[$i]}',\r\n `taxRate` = '{$taxRate[$i]}'\r\n WHERE `taxID` = '{$taxID[$i]}'"; $result_itemTax = mysqli_query($link, $query_itemTax) or die(mysqli_error($link)); $query_insert_tax = "INSERT IGNORE INTO tax\r\n (`taxID`, `taxName`, `taxRate`)\r\n VALUES ('{$taxID[$i]}','{$taxName[$i]}', '{$taxRate[$i]}')"; $result_insert_tax = mysqli_query($link, $query_insert_tax); } if ($result_itemTax || $result_insert_tax) { info('message', 'Item tax updated successfully!'); } else { info('error', 'Cannot update item tax, Please try again!'); }
<?php //error_reporting(E_ALL ^ (E_NOTICE | E_WARNING)); require '../../config/config.php'; require '../../functions/general_functions.php'; $purchaseOrderID = clean($_POST['orderID']); $supplierID = clean($_POST['supplierID']); $itemCode = clean_arr($_POST['itemCode']); $itemLocation = clean_arr($_POST['itemLocation']); $orderQty = clean_arr($_POST['orderQty']); $itemCost = clean_arr($_POST['itemCost']); $purchaseOrderItemID = clean_arr($_POST['purchaseOrderItemID']); $purchaseItemReceivedID = clean_arr($_POST['purchaseItemReceivedID']); // Creating purchase order $query_purchaseorder = "INSERT IGNORE INTO purchaseorder\r\n (`purchaseOrderID`, `purchaseDate`, `supplierID`, `purchaseStatus`)\r\n VALUES ('{$purchaseOrderID}', CURRENT_TIMESTAMP(), '{$supplierID}', 'Draft')"; $result_purchaseorder = mysqli_query($link, $query_purchaseorder) or die(mysqli_error($link)); $purchaseOrderID = empty($purchaseOrderID) ? mysqli_insert_id($link) : $purchaseOrderID; for ($i = 0; $i < count($itemCode); $i++) { $query_location = "SELECT `itemLocationID`, `itemID`, `locationID`\r\n FROM itemlocation\r\n WHERE `itemID` = '{$itemCode[$i]}'\r\n AND `locationID`= '{$itemLocation[$i]}'"; $result_location = mysqli_query($link, $query_location) or die(mysqli_error($link)); $location = mysqli_fetch_array($result_location); $nwItemLocationID = $location['itemLocationID']; $query_purchaseorderitem = "INSERT IGNORE INTO purchaseorderitem\r\n (`purchaseorderitemID`, `purchaseOrderID`, `itemLocationID`, `itemQuantity`, `itemCost`)\r\n VALUES ('{$purchaseOrderItemID[$i]}','{$purchaseOrderID}', {$nwItemLocationID}, '{$orderQty[$i]}', '{$itemCost[$i]}')"; $result_purchaseorderitem = mysqli_query($link, $query_purchaseorderitem) or die(mysqli_error($link)); $nwPurchaseOrderItemID = empty($purchaseOrderItemID[$i]) ? mysqli_insert_id($link) : $purchaseOrderItemID[$i]; $query_purchaseorder_received = "INSERT IGNORE INTO purchaseitemreceived\r\n (`purchaseItemReceivedID`, `purchaseorderitemID`, `purchaseOrderID`, `itemLocationID`,\r\n `orderedQuantity`, `receivedQuantity`, `isReceived`)\r\n VALUES ('{$purchaseItemReceivedID[$i]}', '{$nwPurchaseOrderItemID}', '{$purchaseOrderID}', '{$nwItemLocationID}',\r\n '{$orderQty[$i]}', 0, 0)"; $result_purchaseorder_received = mysqli_query($link, $query_purchaseorder_received) or die(mysqli_error($link)); $nwPurchaseItemReceivedID = empty($purchaseItemReceivedID[$i]) ? mysqli_insert_id($link) : $purchaseItemReceivedID[$i]; $query_update_purchaseorderitem = "UPDATE purchaseorderitem\r\n SET `itemLocationID` = '{$nwItemLocationID}',\r\n `itemQuantity` = '{$orderQty[$i]}',\r\n `itemCost` = '{$itemCost[$i]}'\r\n WHERE `purchaseorderitemID` = '{$nwPurchaseOrderItemID}'"; $result_update_purchaseorderitem = mysqli_query($link, $query_update_purchaseorderitem) or die(mysqli_error($link)); $query_update_item_received = "UPDATE purchaseitemreceived\r\n SET `itemLocationID` = '{$nwItemLocationID}',\r\n `orderedQuantity` = '{$orderQty[$i]}'\r\n WHERE `purchaseItemReceivedID` = '{$nwPurchaseItemReceivedID}'\r\n AND `isReceived` = 0";
require '../../includes/session_validator.php'; require '../../config/config.php'; require '../../functions/general_functions.php'; session_start(); $userID = $_SESSION['userID']; session_commit(); $invoiceID = $_POST['invoiceID']; !empty($_POST['draft']) ? $draft = $_POST['draft'] : ($draft = '0'); !empty($_POST['completed']) ? $completed = $_POST['completed'] : ($completed = '0'); $customerID = $_POST['customerID']; $itemCode = $_POST['itemCode']; $itemLocation = $_POST['itemLocation']; $itemQty = $_POST['itemQty']; $itemPrice = $_POST['itemPrice']; $amountPayed = $_POST['amountPayed']; $invoiceDate = clean_arr($_POST['invoiceDate']); $invoiceItemID = $_POST['invoiceItemID']; for ($m = 0; $m < count($invoiceID); $m++) { // Creating invoice $query_invoice = "UPDATE invoice\r\n SET `invoiceDate` = '{$invoiceDate[$m]}',\r\n `customerID` = '{$customerID[$m]}'\r\n WHERE `invoiceID` = '{$invoiceID[$m]}'"; $result_invoice = mysqli_query($link, $query_invoice) or die(mysqli_error($link)); $id = $invoiceID[$m]; for ($i = 0; $i < count($invoiceItemID[$id]); $i++) { $invitemCode = $itemCode[$id][$i]; // Obtaining all item code depending on invoice id. $invitemLocation = $itemLocation[$id][$i]; // Obtaining all item locations depending on invoice id. $loc = $invoiceItemID[$id][$i]; // Obtaining all ivoice item id depending on invoice id. $invitemQty = $itemQty[$id][$i]; // Obtaining all item quntity depending on invoice id.
<?php require_once '../../config/config.php'; require_once '../../functions/general_functions.php'; $itemID = $_POST['itemCode']; $fromLocation = $_POST['fromLocation']; $toLocation = $_POST['toLocation']; $movedQuantity = clean_arr($_POST['movedQuantity']); $movementRemarks = clean($_POST['movementRemarks']); session_start(); $userID = $_SESSION['userID']; session_commit(); for ($i = 0; $i < count($itemID); $i++) { $query_fromLocation = "SElECT `itemLocationID`\r\n FROM itemlocation\r\n WHERE `itemID` = '{$itemID[$i]}'\r\n AND `locationID` = '{$fromLocation[$i]}'"; $result_fromLocation = mysqli_query($link, $query_fromLocation) or die(mysqli_error($link)); $froItemLocationID = mysqli_fetch_array($result_fromLocation); $fromItemLocationID = $froItemLocationID['itemLocationID']; $query_toLocation = "SElECT `itemLocationID`\r\n FROM itemlocation\r\n WHERE `itemID` = '{$itemID[$i]}'\r\n AND `locationID` = '{$toLocation[$i]}'"; $result_toLocation = mysqli_query($link, $query_toLocation) or die(mysqli_error($link)); $toItemLocationID = mysqli_fetch_array($result_toLocation); $toItemLocation = $toItemLocationID['itemLocationID']; if ($toItemLocation < 1) { $query_to = "INSERT INTO itemlocation\r\n (`itemID`, `locationID`)\r\n VALUES ('{$itemID[$i]}', '{$toLocation[$i]}')"; $result_to = mysqli_query($link, $query_to) or die(mysqli_error($link)); $toItemLocation = mysqli_insert_id($link); } if ($froItemLocationID) { // take item form location $query_take = "UPDATE itemlocation\r\n SET `itemQuantity` = itemQuantity - '{$movedQuantity[$i]}'\r\n WHERE `itemLocationID` = '{$fromItemLocationID}'"; $result_take = mysqli_query($link, $query_take) or die(mysqli_error($link)); // Add items form to location
<?php require '../../includes/session_validator.php'; require '../../config/config.php'; require '../../functions/general_functions.php'; // Getting form data $userID = clean_arr($_POST['userIDd']); $userFullName = clean_arr($_POST['userFullName']); $userEmail = clean_arr($_POST['userEmail']); $userGroupID = clean_arr($_POST['userGroupID']); for ($i = 0; $i < count($userID); $i++) { // Inserting form data to the database $query_user = "******"; $result_user = mysqli_query($link, $query_user) or die(mysqli_error($link)); } if ($result_user) { // Showing success message info('message', 'Updated successfully!'); header('Location: users.php'); } else { // Showing error message info('error', 'Cannot update. Please try again!'); header('Location: users.php'); }
$table = ''; $remove_nodes = array(); $json = json_decode(file_get_contents("http://eu.p2pool.pl:7903/global_stats", 0, $ctx)); if (!empty($json->{"pool_hash_rate"})) { $query = $db->prepare("INSERT INTO `global` (`hash`, `ghash`, `time`) VALUES (:hash, :ghash, :time)"); $query->bindParam(':hash', $json->{"pool_hash_rate"}, PDO::PARAM_STR); $query->bindParam(':ghash', $json->{"network_hashrate"}, PDO::PARAM_STR); $query->bindParam(':time', time(), PDO::PARAM_STR); $query->execute(); unset($json); } $hostname = 'p2pool.dashninja.pl dash.p2pools.us eu.p2pool.pl p2pool.crunchpool.com happymining.de'; $list = host_to_ip(explode(' ', $hostname)); $addr = clean_arr(explode(' ', search_node(explode(' ', $list)))); // first $addr = clean_arr(explode(' ', search_node($addr, 'last'))); // all foreach ($addr as $key => $value) { $uptime = @file_get_contents("http://{$value}:7903/uptime", 0, $ctx); if (empty($uptime)) { clean_nodes($value); continue; } $json = json_decode(@file_get_contents("http://{$value}:7903/local_stats", 0, $ctx), true); if (empty($json)) { clean_nodes($value); continue; } if (!empty($json['miner_hash_rates'])) { $sum = array_sum($json['miner_hash_rates']); $users = count($json['miner_hash_rates']);
* Do not edit or add to this file. * * @author Robert Londo <*****@*****.**> * @copyright 2012 softbill * @version Release: 1.0.0 */ require '../../config/config.php'; require '../../functions/general_functions.php'; $wt_id = clean_arr($_POST['wt_id']); $st_id = clean_arr($_POST['st_id']); $from = clean_arr($_POST['wt_from']); $to = clean_arr($_POST['wt_to']); $wt_rate = clean_arr($_POST['wt_rate']); $service_charge = clean_arr($_POST['service_charge']); $wt_flat_rate = clean_arr($_POST['wt_flat_rate']); $conn_fee = clean_arr($_POST['conn_fee']); $s_flat_rate = clean_arr($_POST['s_flat_rate']); $num_rate = count($wt_rate); for ($i = 0; $i < $num_rate; $i++) { $query_water_tariff = "UPDATE water_tariff\n SET wt_rate = '{$wt_rate[$i]}',\n wt_from = '{$from[$i]}',\n wt_to = '{$to[$i]}',\n wt_flat_rate = '{$wt_flat_rate[$i]}',\n conn_fee = '{$conn_fee[$i]}',\n service_charge = '{$service_charge[$i]}'\n WHERE wt_id = '{$wt_id[$i]}'"; $result_water_tariff = mysql_query($query_water_tariff) or die(mysql_error()); $query_sewer_tariff = "UPDATE sewer_tariff\n SET s_flat_rate = '{$s_flat_rate[$i]}'\n WHERE st_id = '{$st_id[$i]}'"; $result_sewer_tariff = mysql_query($query_sewer_tariff) or die(mysql_error()); } if ($result_water_tariff && $result_sewer_tariff) { info('message', 'Saved successfully!'); header('Location: tariffs.php'); } else { info('error', 'Cannot save, Try again.'); header('Location: tariffs.php'); }
<?php error_reporting(E_ALL ^ (E_NOTICE | E_WARNING)); require '../../config/config.php'; require '../../functions/general_functions.php'; $countSheetStartedDate = clean($_POST['countSheetStartedDate']); $completeDate = clean($_POST['countSheetCompletedDate']); //$countSheetCompletedDate = empty($completeDate) ? NULL : $completeDate; $countSheetCompletedDate = $completeDate; $countSheetID = clean($_POST['countSheetID']); $countSheetRemarks = clean($_POST['countSheetRemarks']); $status = empty($countSheetCompletedDate) ? 'In progress' : 'Completed'; $itemCode = clean_arr($_POST['itemCode']); $sheetItems = clean_arr($_POST['sheetItems']); $itemLocation = clean_arr($_POST['itemLocation']); $countedQuantity = clean_arr($_POST['countedQuantity']); session_start(); $userID = $_SESSION['userID']; session_commit(); $query_count_sheet = "INSERT IGNORE INTO countsheet\r\n (`countSheetID`, `countStartedDate`, `countFinishDate`,\r\n status, `countedBy`, `countSheetRemarks`)\r\n VALUES ('{$countSheetID}', '{$countSheetStartedDate}', '{$countSheetCompletedDate}',\r\n '{$status}', '{$userID}', '{$countSheetRemarks}')"; $result_query_count_sheet = mysqli_query($link, $query_count_sheet) or die(mysqli_error($link)); if (!empty($countSheetID)) { $query_edit_sheet = "UPDATE countsheet\r\n SET `countStartedDate` = '{$countSheetStartedDate}',\r\n `countFinishDate` = '{$countSheetCompletedDate}',\r\n `countSheetRemarks` = '{$countSheetRemarks}'\r\n WHERE `countSheetID` = '{$countSheetID}'"; $result_edit_sheet = mysqli_query($link, $query_edit_sheet) or die(mysqli_error($link)); } $countSheet = !empty($countSheetID) ? $countSheetID : mysqli_insert_id($link); for ($i = 0; $i < count($itemCode); $i++) { $query_itemLocation = "SELECT `itemLocationID`, `itemID`, `locationID`, `itemQuantity`\r\n FROM itemlocation\r\n WHERE `itemID` = '{$itemCode[$i]}'\r\n AND `locationID` = '{$itemLocation[$i]}'"; $result_itemLocation = mysqli_query($link, $query_itemLocation) or die(mysqli_error($link)); $item = mysqli_fetch_array($result_itemLocation); $itemLocationID = $item['itemLocationID'];
* * @author Robert Londo <*****@*****.**> * @copyright 2012 Softbil * @version Release: 1.0.0 */ require '../../config/config.php'; require '../../functions/general_functions.php'; // Getting form data $met_id = clean_arr($_POST['met_id']); $meter_number = clean_arr($_POST['meter_number']); $meter_type = clean_arr($_POST['meter_type']); $meter_status = clean_arr($_POST['meter_status']); $meter_size = clean_arr($_POST['meter_size']); $no_digits = clean_arr($_POST['no_digits']); $initial_reading = clean_arr($_POST['initial_reading']); $meter_remarks = clean_arr($_POST['meter_remarks']); $num_id = count($met_id); for ($i = 0; $i < $num_id; $i++) { // Inserting form data to the database $edit_meter = "UPDATE meter\n SET met_number = '{$meter_number[$i]}',\n met_type = '{$meter_type[$i]}',\n met_size = '{$meter_size[$i]}',\n no_digits = '{$no_digits[$i]}',\n initial_reading = '{$initial_reading[$i]}',\n remarks = '{$meter_remarks[$i]}'\n WHERE met_id = '{$met_id[$i]}'"; $result_edit_meter = mysql_query($edit_meter) or die(mysql_error()); } if ($result_edit_meter) { // Showing success message info('message', 'Updated successfully!'); header('Location: meters.php'); } else { // Showing error message info('error', 'Cannot update. Please try again!'); header('Location: meters.php'); }
$itemLocationsID = $_POST['itemLocationsID']; $itemTaxID = clean_arr($_POST['itemTaxID']); $itemCode = clean_arr($_POST['itemCode']); $itemDescription = clean_arr($_POST['itemDescription']); $itemCategory = clean_arr($_POST['itemCategory']); $itemLocation = $_POST['itemLocation']; $itemQty = clean_arr($_POST['itemQty']); $idealQty = clean_arr($_POST['idealQty']); $warnQty = clean_arr($_POST['warnQty']); $itemCost = clean_arr($_POST['itemCost']); $itemPrice = clean_arr($_POST['itemPrice']); $unitMeasure = clean_arr($_POST['unitMeasure']); $itemTax = clean_arr($_POST['itemTax']); $itemNote = clean_arr($_POST['itemNote']); $itemWebsite = clean_arr($_POST['itemWebsite']); $itemSupplier = clean_arr($_POST['itemSupplier']); //print_r($itemLocation); //exit; for ($i = 0; $i < count($itemsID); $i++) { $query_item = "UPDATE item\r\n SET itemCode = '{$itemCode[$i]}', \r\n `itemDescription` = '{$itemDescription[$i]}', \r\n `itemCategoryID` = '{$itemCategory[$i]}',\r\n `itemCost` = '{$itemCost[$i]}',\r\n `itemPrice` = '{$itemPrice[$i]}', \r\n `unitMeasureID` = '{$unitMeasure[$i]}', \r\n `itemNote` = '{$itemNote[$i]}', \r\n `itemWebsite` = '{$itemWebsite[$i]}',\r\n `supplierID` = '{$itemSupplier[$i]}'\r\n WHERE itemID = '{$itemsID[$i]}'"; $result_item = mysqli_query($link, $query_item) or die; $query_tax = "UPDATE itemtax\r\n SET `taxID` = '{$itemTax[$i]}'\r\n WHERE `itemTaxID` = '{$itemTaxID[$i]}'"; $result_tax = mysqli_query($link, $query_tax) or die(mysqli_error($link)); $id = $itemsID[$i]; for ($j = 0; $j < count($itemLocation[$id]); $j++) { $loc = $itemLocation[$id][$j]; $query_location = "UPDATE itemlocation\r\n SET `locationID` = '{$loc}',\r\n `itemQuantity` = '{$itemQty[$j]}', \r\n `idealQuantity` = '{$idealQty[$j]}',\r\n `warningQuantity` = '{$warnQty[$j]}'\r\n WHERE `itemLocationID` = '{$itemLocationsID[$j]}'"; $result_location = mysqli_query($link, $query_location) or die(mysqli_error($link)); $query_insertitem = "INSERT IGNORE INTO itemlocation\r\n (`itemLocationID`, `itemID`, `locationID`, \r\n `itemQuantity`, `idealQuantity`, `warningQuantity`)\r\n VALUES ('{$itemLocationsID[$j]}', '{$itemsID[$i]}', '{$loc}',\r\n '{$itemQty[$j]}', '{$idealQty[$j]}', '{$warnQty[$j]}')"; $result_insertitem = mysqli_query($link, $query_insertitem) or die(mysqli_error($link)); }
$cust_id = $_POST['cust_id']; $appln_id = $_POST['appln_id']; $appnt_id = $_POST['appnt_id']; $ba_id = $_POST['ba_id']; $appln_type = clean_arr($_POST['appln_type']); $premise_nature = clean_arr($_POST['premise_nature']); $service_nature = clean_arr($_POST['service_nature']); $appnt_type = clean_arr($_POST['appnt_type']); $appnt_fullname = clean_arr($_POST['appnt_fullname']); $appnt_tel = clean_arr($_POST['appnt_tel']); $appnt_post_addr = clean_arr($_POST['appnt_post_addr']); $appnt_phy_addr = clean_arr($_POST['appnt_phy_addr']); $block_no = clean_arr($_POST['block_no']); $plot_no = clean_arr($_POST['plot_no']); $living_area = clean_arr($_POST['living_area']); $living_town = clean_arr($_POST['living_town']); $billing_area = clean_arr($_POST['billing_area']); $cust_no = count($cust_id); for ($i = 0; $i < $cust_no; $i++) { $query_appln = "UPDATE application\r\n SET appln_id = '{$appln_id[$i]}]',\r\n appln_type = '{$appln_type[$i]}',\r\n premise_nature = '{$premise_nature[$i]}',\r\n service_nature_id = '{$service_nature[$i]}'\r\n WHERE appln_id = '{$appln_id[$i]}'"; $result_appln = mysql_query($query_appln) or die(mysql_error()); $query_appnt = "UPDATE applicant\r\n SET appnt_type_id = '{$appnt_type[$i]}',\r\n appnt_fullname = '{$appnt_fullname[$i]}', appnt_tel = '{$appnt_tel[$i]}',\r\n appnt_post_addr = '{$appnt_post_addr[$i]}',\r\n appnt_phy_addr = '{$appnt_phy_addr[$i]}',\r\n block_no = '{$block_no[$i]}',\r\n plot_no = '{$plot_no[$i]}',\r\n living_area = '{$living_area[$i]}',\r\n living_town = '{$living_town[$i]}'\r\n WHERE appnt_id = '{$appnt_id[$i]}'"; $result_appnt = mysql_query($query_appnt) or die(mysql_error()); } if ($result_appnt && $result_appln) { info('message', 'Updated successfully!'); header('Location: customers.php'); } else { info('error', 'Cannot save, Please try again.'); header('Location: customers.php'); }
<?php require_once '../../config/config.php'; require_once '../../functions/general_functions.php'; $countsheetID = clean($_POST['countsheetID']); $itemCode = clean_arr($_POST['itemCode']); $date = clean($_POST['completedDate']); $completedDate = !empty($date) ? $date : date('Y-m-d'); $itemLocation = clean_arr($_POST['itemLocation']); $newQuantity = clean_arr($_POST['newQuantity']); $adjustRemarks = clean($_POST['adjustRemarks']); session_start(); $userID = $_SESSION['userID']; session_commit(); if (!empty($countsheetID)) { $query_count_sheet = "UPDATE countsheet\r\n SET status = 'Completed',\r\n `countFinishDate` = '{$completedDate}'\r\n WHERE `countSheetID` = '{$countsheetID}'"; $result_count_sheet = mysqli_query($link, $query_count_sheet) or die(mysqli_error($link)); } for ($k = 0; $k < count($itemCode); $k++) { $query_itemLocation = "UPDATE itemlocation\r\n SET `itemQuantity` = '{$newQuantity[$k]}'\r\n WHERE `itemID` = '{$itemCode[$k]}'\r\n AND `locationID` = '{$itemLocation[$k]}'"; $result_itemLocation = mysqli_query($link, $query_itemLocation) or die(mysqli_error($link)); $query_movement = "INSERT INTO movements\r\n (`movementType`, `movementDate`, `itemID`, `fromLocation`,\r\n `movedQuantity`, `movementRemarks`, `userID`)\r\n VALUES ('Stock adjustment', CURRENT_TIMESTAMP(), '{$itemCode[$k]}', '{$itemLocation[$k]}',\r\n '{$newQuantity[$k]}', '{$adjustRemarks}', '{$userID}')"; $result_movement = mysqli_query($link, $query_movement) or die(mysqli_error($link)); } if ($result_movement) { info('message', 'Item(s) adjusted successfully!'); header('Location: ../inventory/adjust_stock.php'); } else { info('error', 'Cannot adjust item(s)! Please try again.'); header('Location: ../inventory/adjust_stock.php'); }
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING)); ob_start(); require '../../includes/session_validator.php'; require '../../config/config.php'; require '../../functions/general_functions.php'; session_start(); $userID = $_SESSION['userID']; session_commit(); $draft = clean($_POST['draft']); $completed = clean($_POST['completed']); $customerID = clean($_POST['customerID']); $itemCode = clean_arr($_POST['itemCode']); $itemLocation = clean_arr($_POST['itemLocation']); $itemQty = clean_arr($_POST['itemQty']); $itemPrice = clean_arr($_POST['itemPrice']); $amountPayed = clean($_POST['amountPayed']); $saleDate = clean($_POST['saleDate']); // Creating invoice $query_invoice = "INSERT INTO invoice\r\n (`invoiceDate`, `invoiceStatus`, `customerID`)\r\n VALUES ('{$saleDate}', 'Draft', '{$customerID}')"; $result_invoice = mysqli_query($link, $query_invoice) or die(mysqli_error($link)); $invoiceID = mysqli_insert_id($link); for ($i = 0; $i < count($itemCode); $i++) { $query_location = "SELECT `itemLocationID`, `itemID`, `locationID`\r\n FROM itemlocation\r\n WHERE `itemID` = '{$itemCode[$i]}'\r\n AND `locationID`= '{$itemLocation[$i]}'"; $result_location = mysqli_query($link, $query_location) or die(mysqli_error($link)); $location = mysqli_fetch_array($result_location); $nwItemLocationID = $location['itemLocationID']; $query_invoiceitem = "INSERT INTO invoiceitem\r\n (`invoiceID`, `itemLocationID`, `itemQuantity`, `itemPrice`)\r\n VALUES ('{$invoiceID}', '{$nwItemLocationID}', '{$itemQty[$i]}', '{$itemPrice[$i]}')"; $result_invoiceitem = mysqli_query($link, $query_invoiceitem) or die(mysqli_error($link)); if ($draft) { } elseif ($completed) {
* * DISCLAIMER * * Do not edit or add to this file. * * @author Robert Londo <*****@*****.**> * @copyright 2012 Flight * @version Release: 1.0.0 */ require '../../config/config.php'; require '../../functions/general_functions.php'; $curr_reading = clean_arr($_POST['curr_reading']); $prev_reading = clean_arr($_POST['prev_reading']); $cust_id = clean_arr($_POST['cust_id']); $met_id = clean_arr($_POST['met_id']); $remarks = clean_arr($_POST['remarks']); $billing_date = $_POST['billing_date']; $reading_date = $_POST['reading_date']; $num_meter = count($met_id); for ($i = 0; $i < $num_meter; $i++) { $consumption[$i] = $curr_reading[$i] - $prev_reading[$i]; $query_readings = "INSERT INTO meter_reading\n (billing_date, reading_date, entered_date,\n reading, consumption, met_id, cust_id, remarks)\n VALUES ('{$billing_date}', '{$reading_date}', CURRENT_TIMESTAMP(),\n '{$curr_reading[$i]}', '{$consumption[$i]}', '{$met_id[$i]}', '{$cust_id[$i]}', '{$remarks[$i]}')"; $result_readings = mysql_query($query_readings) or die(mysql_error()); } if ($result_readings) { info('message', 'Meter readings saved!'); header('Location: enter_meter_readings.php'); } else { info('error', 'Cannot save. Please tyr again'); header('Location: enter_meter_readings.php'); }
<?php require_once '../../config/config.php'; require_once '../../functions/general_functions.php'; session_start(); $userID = $_SESSION['userID']; session_commit(); $purchaseID = clean($_POST['orderID']); $purchaseItemReceived = clean_arr($_POST['purchaseItemReceivedID']); $itemID = clean_arr($_POST['itemCode']); $locationID = clean_arr($_POST['itemLocation']); $orderedQuantity = clean_arr($_POST['orderedQuantity']); $receivedQuantity = clean_arr($_POST['receivedQuantity']); $receivedDate = clean_arr($_POST['receivedDate']); $result = array(); $query_purchaseorder = "UPDATE purchaseorder\r\n SET `purchaseStatus` = 'Fully received'\r\n WHERE `purchaseOrderID` = '{$purchaseID}'"; $result_purchaseorder = mysqli_query($link, $query_purchaseorder) or die(mysqli_error($link)); for ($i = 0; $i < count($itemID); $i++) { $query_location = "SELECT `itemLocationID`, `itemID`, `locationID`\r\n FROM itemlocation\r\n WHERE `itemID` = '{$itemID[$i]}'\r\n AND `locationID`= '{$locationID[$i]}'"; $result_location = mysqli_query($link, $query_location) or die(mysqli_error($link)); $location = mysqli_fetch_array($result_location); $itemLocationID = $location['itemLocationID']; if (!empty($purchaseItemReceived[$i])) { $query_received_items = "UPDATE purchaseitemreceived\r\n SET `itemLocationID` = '{$itemLocationID}',\r\n `receivedQuantity` = '{$receivedQuantity[$i]}',\r\n `itemReceivedDate` = '{$receivedDate[$i]}',\r\n `isReceived` = '1'\r\n WHERE `purchaseItemReceivedID` = '{$purchaseItemReceived[$i]}'\r\n AND `isReceived` = '0'"; $result_received_items = mysqli_query($link, $query_received_items) or die(mysqli_error($link)); if (mysqli_affected_rows($link) > 0) { //Creating movements log $query_movement = "INSERT INTO movements\r\n (`movementType`, `movementDate`, `itemID`, `toLocation`,\r\n `movedQuantity`, `userID`, `movementRemarks`)\r\n VALUES ('Receiving', CURRENT_TIMESTAMP(), '{$itemID[$i]}', '{$locationID[$i]}',\r\n '{$receivedQuantity[$i]}', '{$userID}', '{$purchaseID}')"; $result_movement = mysqli_query($link, $query_movement) or die(mysqli_error($link)); //Updating inventory $query_inventory = "UPDATE itemlocation\r\n SET `itemQuantity` = `itemQuantity` + '{$receivedQuantity[$i]}'\r\n WHERE `itemLocationID` = '{$itemLocationID}'";
<?php require './validate_session.php'; require '../config/database.php'; require '../functions/general_functions.php'; $examType = clean($_POST['examType']); $completedYear = clean($_POST['completedYear']); $resultUrl = clean_arr($_POST['resultUrl']); for ($i = 0; $i < count($resultUrl); $i++) { $queryLinks = "INSERT INTO `link`\r\n (`Url`, `ExamType`, `Year`)\r\n VALUES ('{$resultUrl[$i]}', '{$examType}', '{$completedYear}')"; $resultLinks = mysqli_query($link, $queryLinks) or die(mysqli_error($link)); } if ($resultLinks) { info('message', 'Link(s) posted successfully!'); header('Location: results'); } else { info('error', 'Cannot post link(s), Please try again!'); header('Location: post_links'); } ?>
<?php require '../../includes/session_validator.php'; require '../../config/config.php'; require '../../functions/general_functions.php'; $supplierID = clean_arr($_POST['supplierID']); $supplierName = clean_arr($_POST['supplierName']); $supplierContactPerson = clean_arr($_POST['supplierContactPerson']); $supplierAddress = clean_arr($_POST['supplierAddress']); $supplierPhone = clean_arr($_POST['supplierPhone']); $supplierFax = clean_arr($_POST['supplierFax']); $supplierEmail = clean_arr($_POST['supplierEmail']); for ($i = 0; $i < count($supplierID); $i++) { $query_supplier = "UPDATE supplier\r\n SET `supplierName` = '{$supplierName[$i]}',\r\n `supplierContactPerson` = '{$supplierContactPerson[$i]}',\r\n `supplierAddress` = '{$supplierAddress[$i]}',\r\n `supplierPhone` = '{$supplierPhone[$i]}',\r\n `supplierFax` = '{$supplierFax[$i]}',\r\n supplierEmail = '{$supplierEmail[$i]}'\r\n WHERE `supplierID` = '{$supplierID[$i]}'"; $result_supplier = mysqli_query($link, $query_supplier) or die(mysqli_error($link)); } if ($result_supplier) { info('message', 'Supplier(s) updated successfully!'); header('Location: suppliers.php'); } else { info('error', 'Cannot update supplier(s), Please try again'); header('Location: suppliers.php'); }
<?php require '../../includes/session_validator.php'; require '../../config/config.php'; require '../../functions/general_functions.php'; $customerID = clean_arr($_POST['customerID']); $customerName = clean_arr($_POST['customerName']); $customerContactPerson = clean_arr($_POST['customerContactPerson']); $customerContactFirstName = clean_arr($_POST['customerContactFirstName']); $customerAddress = clean_arr($_POST['customerAddress']); $customerPhone = clean_arr($_POST['customerPhone']); $customerFax = clean_arr($_POST['customerFax']); $customerEmail = clean_arr($_POST['customerEmail']); for ($i = 0; $i < count($customerID); $i++) { $query_customer = "UPDATE customer\r\n SET `customerName` = '{$customerName[$i]}',\r\n `customerContactPerson` = '{$customerContactPerson[$i]}',\r\n `customerContactFirstName` = '{$customerContactFirstName[$i]}',\r\n `customerAddress` = '{$customerAddress[$i]}',\r\n `customerPhone` = '{$customerPhone[$i]}',\r\n `customerFax` = '{$customerFax[$i]}',\r\n customerEmail = '{$customerEmail[$i]}'\r\n WHERE `customerID` = '{$customerID[$i]}'"; $result_customer = mysqli_query($link, $query_customer) or die(mysqli_error($link)); } if ($result_customer) { info('message', 'Customer(s) updated successfully!'); header('Location: customers.php'); } else { info('error', 'Cannot update customer(s), Please try again'); header('Location: customers.php'); }
<?php require '../../includes/session_validator.php'; require '../../config/config.php'; require '../../functions/general_functions.php'; $userGroupID = $_POST['userGroupID']; $userGroupName = clean_arr($_POST['userGroupName']); $userGroupDescription = clean_arr($_POST['userGroupDescription']); $uri = $_POST['url']; for ($i = 0; $i < count($userGroupName); $i++) { $query_usergroup = "UPDATE usergroup\r\n SET `userGroupName` = '{$userGroupName[$i]}',\r\n `userGroupDescription`= '{$userGroupDescription[$i]}'\r\n WHERE `userGroupID` = '{$userGroupID[$i]}'"; $result_usergroup = mysqli_query($link, $query_usergroup) or die(mysqli_error($link)); $query_insert_group = "INSERT IGNORE INTO usergroup\r\n (`userGroupID`, `userGroupName`, `userGroupDescription`)\r\n VALUES ('{$userGroupID[$i]}','{$userGroupName[$i]}','{$userGroupDescription[$i]}')"; $result_insert_group = mysqli_query($link, $query_insert_group); $userGroup = mysqli_insert_id($link); if ($userGroup) { $query_datasection = "SELECT `dataSectionID`\r\n FROM datasection"; $result_datasection = mysqli_query($link, $query_datasection) or die(mysqli_error($link)); while ($datasection = mysqli_fetch_array($result_datasection)) { $dataSectionID = $datasection['dataSectionID']; $query_accessright = "INSERT INTO accessright\r\n (`userGroupID`, `dataSectionID`, `accessRead`, `accessWrite`)\r\n VALUES ('{$userGroup}', '{$dataSectionID}', '0', '0')"; $result_accessright = mysqli_query($link, $query_accessright) or die(mysqli_error($link)); } } } if ($result_usergroup || $result_insert_group) { info('message', 'User group(s) updated successfully!'); } else { info('error', 'Cannot update user group(s), Please try again!'); }
* Do not edit or add to this file. * * @author Robert Londo <*****@*****.**> * @copyright 2012 Flight * @version Release: 1.0.0 */ require '../../includes/session_validator.php'; require '../../config/config.php'; require '../../functions/general_functions.php'; // Getting form data $user_id = clean_arr($_POST['user_id']); $usr_fname = clean_arr($_POST['usr_fname']); $usr_mname = clean_arr($_POST['usr_mname']); $usr_lname = clean_arr($_POST['usr_lname']); $email = clean_arr($_POST['email']); $role = clean_arr($_POST['role']); $num_id = count($user_id); for ($i = 0; $i < $num_id; $i++) { // Inserting form data to the database $query_user = "******"; $result_user = mysql_query($query_user) or die(mysql_error()); } if ($result_user) { // Showing success message info('message', 'Updated successfully!'); header('Location: users.php'); } else { // Showing error message info('error', 'Cannot update. Please try again!'); header('Location: users.php'); }
<?php require '../../includes/session_validator.php'; require '../../config/config.php'; require '../../functions/general_functions.php'; $itemCategoryID = $_POST['itemCategoryID']; $categoryName = clean_arr($_POST['categoryName']); for ($i = 0; $i < count($categoryName); $i++) { $query_itemCategory = "UPDATE itemcategory\r\n SET category = '{$categoryName[$i]}'\r\n WHERE `itemCategoryID` = '{$itemCategoryID[$i]}'"; $result_itemCategory = mysqli_query($link, $query_itemCategory) or die(mysqli_error($link)); $query_insert_category = "INSERT IGNORE INTO itemcategory\r\n (`itemCategoryID`, category)\r\n VALUES ('{$itemCategoryID[$i]}','{$categoryName[$i]}')"; $result_insert_category = mysqli_query($link, $query_insert_category); } if ($result_itemCategory || $result_insert_category) { info('message', 'Item category(s) updated successfully!'); } else { info('error', 'Cannot update item category(s), Please try again!'); }
$mc4_tshs = clean($_POST['mc4_tshs']); $mc5_activity = $_POST['mc5_activity']; $mc6a = $_POST['mc6a']; $mc6b = $_POST['mc6b']; $mc6c = $_POST['mc6c']; $mc6d = $_POST['mc6d']; $mc6e = $_POST['mc6e']; $mc6f = $_POST['mc6f']; $mc6g = $_POST['mc6g']; $mc6h = $_POST['mc6h']; $me1a = $_POST['me1a']; $me1b = $_POST['me1b']; $me1c = $_POST['me1c']; /* ########################### END SECTION F ############################### */ // Geting form approval details $org_person = clean_arr($_POST['org_person']); $completed_date = clean($_POST['completed_date']); $approved_date = clean($_POST['approved_date']); $received_date = clean($_POST['received_date']); $captured_date = clean($_POST['captured_date']); $captured_by = clean($_POST['captured_by']); $verified_date = clean($_POST['verified_date']); $verified_by = clean($_POST['verified_by']); $filed_date = clean($_POST['filed_date']); $comments = clean($_POST['comments']); $comments_zac = clean($_POST['comments_zac']); /* ########################### END FORM APPROVAL ############################### */ $query_ans = "UPDATE tblzhafigures\r\n SET `ZhaFigureValue` = CASE"; if (!empty($part_male)) { $query_ans .= " WHEN FormSerialNumber = '" . $form_no . "' AND ZhaFigureCode = 'CD9' AND BreakdownTypeID1 = 'PRT' AND BreakdownTypeID2 = 'MAL' AND BreakdownTypeID3 = '' AND BreakdownTypeID4 = '' THEN '" . $part_male . "'"; }
<?php require '../../config/config.php'; require '../../functions/general_functions.php'; session_start(); $userID = $_SESSION['userID']; session_commit(); $supplierID = clean($_POST['supplierID']); $itemCode = clean_arr($_POST['itemCode']); $itemLocation = clean_arr($_POST['itemLocation']); $orderQty = clean_arr($_POST['orderQty']); $itemCost = clean_arr($_POST['itemCost']); $amountPayed = clean($_POST['amountPayed']); // Creating purchase order $query_purchaseorder = "INSERT INTO purchaseorder\r\n (`purchaseDate`, `supplierID`, `purchaseStatus`)\r\n VALUES (CURRENT_TIMESTAMP(), '{$supplierID}', 'Paid')"; $result_purchaseorder = mysqli_query($link, $query_purchaseorder) or die(mysqli_error($link)); $purchaseOrderID = mysqli_insert_id($link); for ($i = 0; $i < count($itemCode); $i++) { $query_location = "SELECT `itemLocationID`, `itemID`, `locationID`\r\n FROM itemlocation\r\n WHERE `itemID` = '{$itemCode[$i]}'\r\n AND `locationID`= '{$itemLocation[$i]}'"; $result_location = mysqli_query($link, $query_location) or die(mysqli_error($link)); $location = mysqli_fetch_array($result_location); $nwItemLocationID = $location['itemLocationID']; $query_purchaseorderitem = "INSERT INTO purchaseorderitem\r\n (`purchaseOrderID`, `itemLocationID`, `itemQuantity`, `itemCost`)\r\n VALUES ('{$purchaseOrderID}', {$nwItemLocationID}, '{$orderQty[$i]}', '{$itemCost[$i]}')"; $result_purchaseorderitem = mysqli_query($link, $query_purchaseorderitem) or die(mysqli_error($link)); $purchaseOrderItemID = mysqli_insert_id($link); $query_item_received = "INSERT INTO purchaseitemreceived\r\n (`purchaseorderitemID`, `purchaseOrderID`, `itemLocationID`,\r\n `orderedQuantity`, `receivedQuantity`, `itemReceivedDate`, `isReceived`)\r\n VALUES ('{$purchaseOrderItemID}', '{$purchaseOrderID}', '{$nwItemLocationID}',\r\n '{$orderQty[$i]}', '{$orderQty[$i]}', CURRENT_TIMESTAMP(), 1)"; $result_item_received = mysqli_query($link, $query_item_received) or die(mysqli_error($link)); //Creating movements log $query_movement = "INSERT INTO movements\r\n (`movementType`, `movementDate`, `itemID`, `toLocation`,\r\n `movedQuantity`, `userID`, `movementRemarks`)\r\n VALUES ('Receiving', CURRENT_TIMESTAMP(), '{$itemCode[$i]}', '{$itemLocation[$i]}',\r\n '{$orderQty[$i]}', '{$userID}', '{$purchaseOrderID}')"; $result_movement = mysqli_query($link, $query_movement) or die(mysqli_error($link)); //Updating inventory
<?php error_reporting(E_ALL ^ (E_NOTICE | E_WARNING)); require '../../includes/session_validator.php'; require_once '../../config/config.php'; require_once '../../functions/general_functions.php'; date_default_timezone_set('Africa/Dar_es_Salaam'); // Setting timezone. $customerID = clean($_GET['customerID']); $receiptNo = clean($_GET['receiptNo']); $itemID = clean_arr($_GET['itemID']); $soldQnty = clean_arr($_GET['soldQnty']); $itemPrice = clean_arr($_GET['itemPrice']); $amountPayed = clean($_GET['amountPayed']); // Getting company details. $query_company = "SELECT `companyName`, `companyAddress`, `companyPhone`,\r\n `companyFax`, `companyEmail`, `companyWebsite`,\r\n `companyLogo`\r\n FROM company"; $result_company = mysqli_query($link, $query_company) or die(mysqli_error($link)); $company = mysqli_fetch_array($result_company); session_start(); $cashier = $_SESSION['userFullName']; // Getting cashier name. session_commit(); // Getting customer details. $query_customer = "SELECT `customerID`, `customerName`, `customerAddress`,\r\n `customerPhone`, `customerFax`, `customerEmail`\r\n FROM customer\r\n WHERE `customerID` = '{$customerID}'"; $result_customer = mysqli_query($link, $query_customer) or die(mysqli_error($link)); $customer = mysqli_fetch_array($result_customer); ?> <!DOCTYPE html> <html> <head>
<?php require '../../includes/session_validator.php'; require '../../config/config.php'; require '../../functions/general_functions.php'; $itemCode = clean($_POST['itemCode']); $itemDescription = clean($_POST['itemDescription']); $itemCategory = clean($_POST['itemCategory']); $itemLocation = clean_arr($_POST['itemLocation']); $itemQty = clean_arr($_POST['itemQty']); $idealQty = clean_arr($_POST['idealQty']); $warnQty = clean_arr($_POST['warnQty']); $itemCost = clean($_POST['itemCost']); $itemPrice = clean($_POST['itemPrice']); $unitMeasure = clean($_POST['unitMeasure']); $itemTax = clean($_POST['itemTax']); $itemNote = clean($_POST['itemNote']); $itemWebsite = clean($_POST['itemWebsite']); $itemSupplier = clean($_POST['itemSupplier']); $query_item = "INSERT INTO item\r\n (`itemCode`, `itemDescription`, `itemCategoryID`, `itemCost`,\r\n `itemPrice`, `unitMeasureID`, `itemNote`, `itemWebsite`, `supplierID`)\r\n VALUES('{$itemCode}', '{$itemDescription}', '{$itemCategory}', '{$itemCost}',\r\n '{$itemPrice}', '{$unitMeasure}', '{$itemNote}', '{$itemWebsite}', '{$itemSupplier}')"; $result_item = mysqli_query($link, $query_item) or die; $itemID = mysqli_insert_id($link); $query_tax = "INSERT INTO itemtax\r\n (`itemID`, `taxID`)\r\n VALUES ('{$itemID}', '{$itemTax}')"; $result_tax = mysqli_query($link, $query_tax) or die(mysqli_error($link)); for ($i = 0; $i < count($itemLocation); $i++) { $query_location = "INSERT INTO itemlocation\r\n (`itemID`, `locationID`, `itemQuantity`, `idealQuantity`, `warningQuantity`)\r\n VALUES ('{$itemID}', '{$itemLocation[$i]}', '{$itemQty[$i]}', '{$idealQty[$i]}', '{$warnQty[$i]}')"; $result_location = mysqli_query($link, $query_location) or die(mysqli_error($link)); } if ($result_item && $result_tax && $result_location) { info('message', 'Item added successfully!'); header('Location: add_item.php');