public function array_value() { $value = array(); $value = parent::array_value(); $value['branch_id'] = $this->branch_id; return $value; }
function update_inventory_status($sku, $field, $adjustment, $item_cost, $vendor_id, $desc) { if ($field != 'quantity_on_hand') { return parent::update_inventory_status($sku, $field, $adjustment, $item_cost, $vendor_id, $desc); } return true; }
public function inventory($newInventory = null, $save = true) { static $inventory = null; if ($newInventory) { if ($newInventory instanceof inventory) { $this->inventory_id = $newInventory->id; $inventory = $newInventory; } else { if (is_int($newInventory)) { $this->inventory_id = $newInventory; $inventory = inventory::load_one($newInventory); } } if ($save) { $this->save(); } return $inventory; } if (!$inventory) { $inventory = inventory::load_one($this->inventory_id); } return $inventory; }
<!-- model to show stock of inventory for admin--> <div id="myModal" class="modal fade" role="dialog"> <div class="modal-dialog modal-lg"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">STOCK</h4> </div> <!-- contents of model here --> <div class="modal-body"> <?php $db = database::getInstance(); // $number,$brand_id,$branch_identifier=null $InvObj = new inventory(); $values_central = $InvObj->show_inventory(); $BranchInvObj = new branch_inventory(); $values_branch = $BranchInvObj->show_inventory(); ?> <!-- shows central inventory stock --> <h4>Central Inventory</h4> <table class="table table-bordered"> <tr> <th>SN</th> <th>Bike</th> <th>Quantity in numbers</th> </tr> <?php $i = 1;
} else { $style = ""; } echo "<tr {$style} >"; echo "<td><span class='clickspot' onclick='getDesc({$row['equipment_id']})'>{$row['equipment_name']}<span></td>"; echo "<td>{$row['description']}</td>"; echo "<td>{$row['equipment_id']}</td>"; echo "<td>{$row['price']}</td>"; echo "<td><a href='editeqpt.php'>edit</a> <a href='searchEquipment.php'>delete</a></td>"; echo "</tr>"; $row = $obj->fetch(); $i++; } if (isset($_REQUEST['equipment_name'])) { echo $_REQUEST['equipment_name']; $obj = new inventory(); $equipment_name = $_REQUEST['equipment_name']; if (!$obj->delete_equipment($equipment_name)) { echo "Error deleting" . mysql_error(); } else { header("location:searchEquipment.php"); } } ?> </div> </body> </html>
$inventory = new inventory(); $inventory->id=$_GET['id']; $inventory->domain_id=domain_id::get(); $inventory->product_id=$_POST['product_id']; $inventory->quantity=$_POST['quantity']; $inventory->cost=$_POST['cost']; $inventory->date=$_POST['date']; $inventory->note=$_POST['note']; $result = $inventory->update(); $saved = !empty($result) ? "true" : "false"; } $invoices = new invoice(); $invoices->sort='id'; $invoice_all = $invoices->select_all('count'); $get_inventory = new inventory(); $get_inventory->id = $_GET['id']; $inventory = $get_inventory->select(); $product_all = product::get_all(); $smarty -> assign('product_all',$product_all); $smarty -> assign('saved',$saved); $smarty -> assign('inventory',$inventory); $smarty -> assign('pageActive', 'inventory'); $smarty -> assign('subPageActive', 'inventory_edit'); $smarty -> assign('active_tab', '#product');
// Calculator Dacemal Button else if(e.keyCode == 110 || e.keyCode == 190) { // alert('Press Decimal'); var current = $(".calculator input").val(); newcurrent = current+ '.'; if(current == '0'){newcurrent = $codeVal; } $(".calculator input").val(newcurrent); } }); }); </script> </head> <body> <?php if (!isset($_SESSION['faizan'])) { $inventorty = new inventory(); $terminallist = new terminal(); $barcode = array(987654321, 1234567891, 159753825, 123456788); foreach ($barcode as $value) { $_SESSION['barcode'] = $value; $_SESSION['barcode_detail'] = $inventorty->get_product($value); $terminallist->add_item_list(1); } } ?> <!-- Payment Mode --> <span id="paymentMode" style="display:none;">cash</span> <!-- Modal --> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document">
<?php require_once 'common/init.php'; $inventorty = new inventory(); if (isset($_GET['bc'])) { $barcode = $_GET['bc']; $results = $inventorty->get_product($barcode); if ($results) { foreach ($results as $res) { $barcode_detail = array('product_id' => $res->inv_id, 'name' => $res->inv_name, 'price' => $res->inv_price, 'quantity' => 1); $_SESSION['barcode'] = $barcode; print_f($_SESSION['barcode']); $_SESSION['barcode_detail'] = $barcode_detail; print_f($_SESSION['barcode_detail']); } } else { echo 'Error'; } } /* echo $barcode = $_GET['bc']; $barcode_detail = array ( 'product_id' => 1, 'name' => 'Shahsons Picasso Ball Pen', 'price' => '100', 'quantity' => 1, ); $_SESSION['barcode'] = $barcode; $_SESSION['barcode_detail'] = $barcode_detail;
function save() { global $db, $messageStack, $security_level, $currencies; $bom_list = array(); for ($x = 0; $x < count($_POST['assy_sku']); $x++) { $bom_list[$x] = array('ref_id' => $this->id, 'sku' => db_prepare_input($_POST['assy_sku'][$x]), 'description' => db_prepare_input($_POST['assy_desc'][$x]), 'qty' => $currencies->clean_value(db_prepare_input($_POST['assy_qty'][$x]))); $result = $db->Execute("select id from " . TABLE_INVENTORY . " where sku = '" . $_POST['assy_sku'][$x] . "'"); if (($result->RecordCount() == 0 || $currencies->clean_value($_POST['assy_qty'][$x]) == 0) && ($_POST['assy_sku'][$x] = !'')) { // show error, bad sku, negative quantity. error check sku is valid and qty > 0 $error = $messageStack->add(INV_ERROR_BAD_SKU . db_prepare_input($_POST['assy_sku'][$x]), 'error'); } else { $prices = inv_calculate_sales_price(abs($this->bom[$x]['qty']), $result->fields['id'], 0, 'v'); $bom_list[$x]['item_cost'] = strval($prices['price']); $prices = inv_calculate_sales_price(abs($this->bom[$x]['qty']), $result->fields['id'], 0, 'c'); $bom_list[$x]['full_price'] = strval($prices['price']); } } $this->bom = $bom_list; $current_situation = $db->Execute("select * from " . TABLE_INVENTORY . " where id = '" . $this->id . "'"); $sql_data_array = parent::save(); if ($sql_data_array == false) { return false; } $result = $db->Execute("select last_journal_date, quantity_on_hand from " . TABLE_INVENTORY . " where id = " . $this->id); $this->allow_edit_bom = ($result->fields['last_journal_date'] == '0000-00-00 00:00:00' || $result->fields['last_journal_date'] == '') && ($result->fields['quantity_on_hand'] == 0 || $result->fields['quantity_on_hand'] == '') ? true : false; if ($error) { return false; } if ($this->allow_edit_bom == true) { // only update if no posting has been performed $result = $db->Execute("delete from " . TABLE_INVENTORY_ASSY_LIST . " where ref_id = " . $this->id); foreach ($bom_list as $list_array) { unset($list_array['item_cost']); unset($list_array['full_price']); db_perform(TABLE_INVENTORY_ASSY_LIST, $list_array, 'insert'); } } $sql_data_array['inventory_type'] = 'ia'; // split attributes $attr0 = array(); $attr1 = array(); if ($this->ms_attr_0 != '') { $attr0 = explode(',', $this->ms_attr_0); } if ($this->ms_attr_1 != '') { $attr1 = explode(',', $this->ms_attr_1); } if (empty($attr0)) { $this->get_ms_list(); return false; // no attributes, nothing to do } // build skus $sku_list = array(); for ($i = 0; $i < count($attr0); $i++) { $idx0 = explode(':', $attr0[$i]); if (empty($attr1)) { if ($idx0[0] != '') { $sku_list[] = $this->sku . '-' . $idx0[0]; $variables[$this->sku . '-' . $idx0[0]]['idx0'] = $idx0[1]; } } else { for ($j = 0; $j < count($attr1); $j++) { $idx1 = explode(':', $attr1[$j]); if ($idx0[0] != '' && $idx1[0] != '') { $sku_list[] = $this->sku . '-' . $idx0[0] . $idx1[0]; $variables[$this->sku . '-' . $idx0[0] . $idx1[0]]['idx0'] = $idx0[1]; $variables[$this->sku . '-' . $idx0[0] . $idx1[0]]['idx1'] = $idx1[1]; } } } } // either update, delete or insert sub skus depending on sku list $result = $db->Execute("select sku from " . TABLE_INVENTORY . " where inventory_type = 'ia' and sku like '" . $this->sku . "-%'"); $existing_sku_list = array(); while (!$result->EOF) { $existing_sku_list[] = $result->fields['sku']; $result->MoveNext(); } $delete_list = array_diff($existing_sku_list, $sku_list); $update_list = array_intersect($existing_sku_list, $sku_list); $insert_list = array_diff($sku_list, $update_list); foreach ($insert_list as $sku) { // first insert new sku's with all fields $sql_data_array['sku'] = $sku; $sql_data_array['description_short'] = sprintf($this->description_short, $variables[$sku]['idx0'], $variables[$sku]['idx1']); $sql_data_array['description_purchase'] = sprintf($this->description_purchase, $variables[$sku]['idx0'], $variables[$sku]['idx1']); $sql_data_array['description_sales'] = sprintf($this->description_sales, $variables[$sku]['idx0'], $variables[$sku]['idx1']); db_perform(TABLE_INVENTORY, $sql_data_array, 'insert'); $new_id = db_insert_id(); foreach ($this->purchase_array as $purchase_row) { $purchase_data_array = array('sku' => $sku, 'vendor_id' => $purchase_row['vendor_id'], 'description_purchase' => sprintf($purchase_row['description_purchase'], $variables[$sku]['idx0'], $variables[$sku]['idx1']), 'item_cost' => $purchase_row['item_cost'], 'purch_package_quantity' => $purchase_row['purch_package_quantity'], 'purch_taxable' => $purchase_row['purch_taxable'], 'price_sheet_v' => $purchase_row['price_sheet_v']); db_perform(TABLE_INVENTORY_PURCHASE, $purchase_data_array, 'insert'); } foreach ($bom_list as $list_array) { $list_array['ref_id'] = $new_id; unset($list_array['item_cost']); unset($list_array['full_price']); db_perform(TABLE_INVENTORY_ASSY_LIST, $list_array, 'insert'); } } if ($this->id != '') { //only update fields that are changed otherwise fields in the child could be overwritten foreach ($current_situation->fields as $key => $value) { // remove fields where the parent is unchanged because the childeren could have different values in these fields. switch ($key) { case 'description_short': if ($this->description_short == $value) { unset($sql_data_array[$key]); } break; case 'description_purchase': if ($this->description_purchase == $value) { unset($sql_data_array[$key]); } break; case 'description_sales': if ($this->description_sales == $value) { unset($sql_data_array[$key]); } break; default: if ($sql_data_array[$key] == $value) { unset($sql_data_array[$key]); } } } } foreach ($update_list as $sku) { //update with reduced number of fields. $sql_data_array['sku'] = $sku; if (isset($sql_data_array['description_short'])) { $sql_data_array['description_short'] = sprintf($this->description_short, $variables[$sku]['idx0'], $variables[$sku]['idx1']); } if (isset($sql_data_array['description_purchase'])) { $sql_data_array['description_purchase'] = sprintf($this->description_purchase, $variables[$sku]['idx0'], $variables[$sku]['idx1']); } if (isset($sql_data_array['description_sales'])) { $sql_data_array['description_sales'] = sprintf($this->description_sales, $variables[$sku]['idx0'], $variables[$sku]['idx1']); } db_perform(TABLE_INVENTORY, $sql_data_array, 'update', "sku = '" . $sku . "'"); foreach ($this->backup_purchase_array as $backUpKey => $backUpRow) { $backUpRow['description_purchase'] = sprintf($backUpRow['description_purchase'], $variables[$sku]['idx0'], $variables[$sku]['idx1']); $purchase_data_array = null; if ($backUpRow['action'] == 'delete') { $result = $db->Execute("delete from " . TABLE_INVENTORY_PURCHASE . " where sku = '" . $sku . "' and vendor_id = '" . $backUpRow['vendor_id'] . "'"); } else { if ($backUpRow['action'] == 'insert') { $purchase_data_array = $backUpRow; unset($purchase_data_array['id']); unset($purchase_data_array['action']); $purchase_data_array['sku'] = $sku; db_perform(TABLE_INVENTORY_PURCHASE, $purchase_data_array, 'insert'); } else { /*on purpose removed this part because iam not sure what to update and what not * $purchase_data_array = $backUpRow; unset($purchase_data_array['id']); unset($purchase_data_array['action']); foreach($backUpRow as $key => $value) { if($key == 'action' || $key == 'id' ) break; if($this->purchase_array[$backUpKey][$key] == $value){ unset($purchase_data_array[$key]); } } db_perform(TABLE_INVENTORY_PURCHASE, $purchase_data_array, 'update', "sku = '" . $sku. "' and vendor_id = '".$backUpRow['vendor_id']."'");*/ } } } $result = $db->Execute("select id, last_journal_date, quantity_on_hand from " . TABLE_INVENTORY . " where sku = '" . $sku . "'"); $this->allow_edit_bom = ($result->fields['last_journal_date'] == '0000-00-00 00:00:00' || $result->fields['last_journal_date'] == '') && ($result->fields['quantity_on_hand'] == 0 || $result->fields['quantity_on_hand'] == '') ? true : false; if ($this->allow_edit_bom == true) { // only update if no posting has been performed $temp = $db->Execute("delete from " . TABLE_INVENTORY_ASSY_LIST . " where ref_id = " . $result->fields['id']); foreach ($bom_list as $list_array) { $list_array['ref_id'] = $result->fields['id']; unset($list_array['item_cost']); unset($list_array['full_price']); db_perform(TABLE_INVENTORY_ASSY_LIST, $list_array, 'insert'); } } } if (count($delete_list) && $security_level < 4) { $messageStack->add(ERROR_NO_PERMISSION, 'error'); $this->get_ms_list(); return false; } foreach ($delete_list as $sku) { $temp = $this->ia_check_remove($sku); if ($temp === true) { $result = $db->Execute("delete from " . TABLE_INVENTORY . " where sku = '" . $sku . "'"); $result = $db->Execute("delete from " . TABLE_INVENTORY_PURCHASE . " where sku = '" . $sku . "'"); $result = $db->Execute("select id, last_journal_date, quantity_on_hand from " . TABLE_INVENTORY . " where sku = '" . $sku . "'"); $temp = $db->Execute("delete from " . TABLE_INVENTORY_ASSY_LIST . " where ref_id = " . $result->fields['id']); } elseif ($temp === false) { $result = $db->Execute("update " . TABLE_INVENTORY . " set inactive = '1' where sku = '" . $sku . "'"); } } // update/insert into inventory_ms_list table $result = $db->Execute("select id from " . TABLE_INVENTORY_MS_LIST . " where sku = '" . $this->sku . "'"); $exists = $result->RecordCount(); $data_array = array('sku' => $this->sku, 'attr_0' => $this->ms_attr_0, 'attr_name_0' => $this->attr_name_0, 'attr_1' => $this->ms_attr_1, 'attr_name_1' => $this->attr_name_1); if ($exists) { db_perform(TABLE_INVENTORY_MS_LIST, $data_array, 'update', "id = " . $result->fields['id']); } else { db_perform(TABLE_INVENTORY_MS_LIST, $data_array, 'insert'); } $this->get_ms_list(); return true; }
<?php header("Content-type: text/xml"); //$start = (isset($_POST['start'])) ? $_POST['start'] : "0" ; $dir = isset($_POST['sortorder']) ? $_POST['sortorder'] : "DESC"; $sort = isset($_POST['sortname']) ? $_POST['sortname'] : "id"; $rp = isset($_POST['rp']) ? $_POST['rp'] : "25"; $page = isset($_POST['page']) ? $_POST['page'] : "1"; //$sql = "SELECT * FROM ".TB_PREFIX."invoices LIMIT $start, $limit"; $inventory = new inventory(); $inventory->sort = $sort; $inventory_all = $inventory->select_all('', $dir, $rp, $page); $sth_count_rows = $inventory->select_all('count', $dir, $rp, $page); $xml = ""; $count = $sth_count_rows; $xml .= "<rows>"; $xml .= "<page>{$page}</page>"; $xml .= "<total>{$count}</total>"; foreach ($inventory_all as $row) { $xml .= "<row id='" . $row['id'] . "'>"; $xml .= "<cell><![CDATA[\n\t\t<a class='index_table' title='{$LANG['view']} " . $row['name'] . "' href='index.php?module=inventory&view=view&id={$row['id']}'><img src='images/common/view.png' height='16' border='-5px' padding='-4px' valign='bottom' /></a>\n\t\t<a class='index_table' title='{$LANG['edit']} " . $row['name'] . "' href='index.php?module=inventory&view=edit&id={$row['id']}'><img src='images/common/edit.png' height='16' border='-5px' padding='-4px' valign='bottom' /></a>\n\t\t]]></cell>"; $xml .= "<cell><![CDATA[" . $row['date'] . "]]></cell>"; $xml .= "<cell><![CDATA[" . $row['description'] . "]]></cell>"; $xml .= "<cell><![CDATA[" . siLocal::number($row['quantity']) . "]]></cell>"; $xml .= "<cell><![CDATA[" . siLocal::number($row['cost']) . "]]></cell>"; $xml .= "<cell><![CDATA[" . siLocal::number($row['total_cost']) . "]]></cell>"; $xml .= "</row>"; } $xml .= "</rows>"; echo $xml; ?>
<?php require_once 'header.php'; ?> <section> <hr/> <div class="container"> <div class="row"> <div class="tableHeading"> <p class="nomargin alignCenter">View Inventory</p> </div> <div class="col-md-12"> <?php $inventory = new inventory(); $results = $inventory->get_int(); if ($results) { ?> <table border="1" cellpadding="5" cellspacing="0" class="table table-hover tableView"> <tr> <th>Product ID</th> <th>Product Name</th> <th>Product Cost</th> <th>Product Price</th> <th>Product Quantity</th> <th>Product Barcode</th> <th>Product Date</th> <th>Action</th> </tr> <?php foreach ($results as $res) { echo '<tr>';
function add_sub(inventory $obj) { return $obj->add_sub_inventory(); }
function save() { global $db, $currencies, $messageStack; $bom_list = array(); for ($x = 0; $x < count($_POST['assy_sku']); $x++) { $bom_list[$x] = array('ref_id' => $this->id, 'sku' => db_prepare_input($_POST['assy_sku'][$x]), 'description' => db_prepare_input($_POST['assy_desc'][$x]), 'qty' => $currencies->clean_value(db_prepare_input($_POST['assy_qty'][$x]))); $result = $db->Execute("select id from " . TABLE_INVENTORY . " where sku = '" . $_POST['assy_sku'][$x] . "'"); if (($result->RecordCount() == 0 || $currencies->clean_value($_POST['assy_qty'][$x]) == 0) && ($_POST['assy_sku'][$x] = !'')) { // show error, bad sku, negative quantity. error check sku is valid and qty > 0 $error = $messageStack->add(INV_ERROR_BAD_SKU . db_prepare_input($_POST['assy_sku'][$x]), 'error'); } else { $prices = inv_calculate_sales_price(abs($this->bom[$x]['qty']), $result->fields['id'], 0, 'v'); $bom_list[$x]['item_cost'] = strval($prices['price']); $prices = inv_calculate_sales_price(abs($this->bom[$x]['qty']), $result->fields['id'], 0, 'c'); $bom_list[$x]['full_price'] = strval($prices['price']); } } $this->bom = $bom_list; if (!parent::save()) { return false; } $result = $db->Execute("select last_journal_date, quantity_on_hand from " . TABLE_INVENTORY . " where id = " . $this->id); $this->allow_edit_bom = ($result->fields['last_journal_date'] == '0000-00-00 00:00:00' || $result->fields['last_journal_date'] == '') && ($result->fields['quantity_on_hand'] == 0 || $result->fields['quantity_on_hand'] == '') ? true : false; if ($error) { return false; } if ($this->allow_edit_bom == true) { // only update if no posting has been performed $result = $db->Execute("delete from " . TABLE_INVENTORY_ASSY_LIST . " where ref_id = " . $this->id); while ($list_array = array_shift($bom_list)) { unset($list_array['item_cost']); unset($list_array['full_price']); db_perform(TABLE_INVENTORY_ASSY_LIST, $list_array, 'insert'); } } return true; }
function save() { global $db, $messageStack, $security_level, $currencies; $current_situation = $db->Execute("select * from " . TABLE_INVENTORY . " where id = '{$this->id}'"); $sql_data_array = parent::save(); if ($sql_data_array == false) { return false; } $sql_data_array['inventory_type'] = 'mi'; // split attributes $attr0 = array(); $attr1 = array(); if ($this->ms_attr_0 != '') { $attr0 = explode(',', $this->ms_attr_0); } if ($this->ms_attr_1 != '') { $attr1 = explode(',', $this->ms_attr_1); } if (empty($attr0)) { $this->get_ms_list(); return false; // no attributes, nothing to do } // build skus $sku_list = array(); for ($i = 0; $i < count($attr0); $i++) { $idx0 = explode(':', $attr0[$i]); if (empty($attr1)) { if ($idx0[0] != '') { $sku_list[] = $this->sku . '-' . $idx0[0]; $variables[$this->sku . '-' . $idx0[0]]['idx0'] = $idx0[1]; } } else { for ($j = 0; $j < count($attr1); $j++) { $idx1 = explode(':', $attr1[$j]); if ($idx0[0] != '' && $idx1[0] != '') { $sku_list[] = $this->sku . '-' . $idx0[0] . $idx1[0]; $variables[$this->sku . '-' . $idx0[0] . $idx1[0]]['idx0'] = $idx0[1]; $variables[$this->sku . '-' . $idx0[0] . $idx1[0]]['idx1'] = $idx1[1]; } } } } // either update, delete or insert sub skus depending on sku list $result = $db->Execute("select sku from " . TABLE_INVENTORY . " where inventory_type = 'mi' and sku like '{$this->sku}-%'"); $existing_sku_list = array(); while (!$result->EOF) { $existing_sku_list[] = $result->fields['sku']; $result->MoveNext(); } $delete_list = array_diff($existing_sku_list, $sku_list); $update_list = array_intersect($existing_sku_list, $sku_list); $insert_list = array_diff($sku_list, $update_list); foreach ($insert_list as $sku) { // first insert new sku's with all fields $sql_data_array['sku'] = $sku; $sql_data_array['description_short'] = sprintf($this->description_short, $variables[$sku]['idx0'], $variables[$sku]['idx1']); $sql_data_array['description_purchase'] = sprintf($this->description_purchase, $variables[$sku]['idx0'], $variables[$sku]['idx1']); $sql_data_array['description_sales'] = sprintf($this->description_sales, $variables[$sku]['idx0'], $variables[$sku]['idx1']); db_perform(TABLE_INVENTORY, $sql_data_array, 'insert'); foreach ($this->purchase_array as $purchase_row) { $purchase_data_array = array('sku' => $sku, 'vendor_id' => $purchase_row['vendor_id'], 'description_purchase' => sprintf($purchase_row['description_purchase'], $variables[$sku]['idx0'], $variables[$sku]['idx1']), 'item_cost' => $purchase_row['item_cost'], 'purch_package_quantity' => $purchase_row['purch_package_quantity'], 'purch_taxable' => $purchase_row['purch_taxable'], 'price_sheet_v' => $purchase_row['price_sheet_v']); db_perform(TABLE_INVENTORY_PURCHASE, $purchase_data_array, 'insert'); } } if ($this->id != '') { //only update fields that are changed otherwise fields in the child could be overwritten foreach ($current_situation->fields as $key => $value) { // remove fields where the parent is unchanged because the childeren could have different values in these fields. switch ($key) { case 'description_short': if ($this->description_short == $value) { unset($sql_data_array[$key]); } break; case 'description_purchase': if ($this->description_purchase == $value) { unset($sql_data_array[$key]); } break; case 'description_sales': if ($this->description_sales == $value) { unset($sql_data_array[$key]); } break; case 'minimum_stock_level': if ($currencies->clean_value($this->minimum_stock_level) == $currencies->clean_value($value)) { unset($sql_data_array[$key]); } break; case 'reorder_quantity': if ($currencies->clean_value($this->reorder_quantity) == $currencies->clean_value($value)) { unset($sql_data_array[$key]); } break; default: if ($sql_data_array[$key] == $value) { unset($sql_data_array[$key]); } } } } foreach ($update_list as $sku) { //update with reduced number of fields. $sql_data_array['sku'] = $sku; if (isset($sql_data_array['description_short'])) { $sql_data_array['description_short'] = sprintf($this->description_short, $variables[$sku]['idx0'], $variables[$sku]['idx1']); } if (isset($sql_data_array['description_purchase'])) { $sql_data_array['description_purchase'] = sprintf($this->description_purchase, $variables[$sku]['idx0'], $variables[$sku]['idx1']); } if (isset($sql_data_array['description_sales'])) { $sql_data_array['description_sales'] = sprintf($this->description_sales, $variables[$sku]['idx0'], $variables[$sku]['idx1']); } db_perform(TABLE_INVENTORY, $sql_data_array, 'update', "sku = '" . $sku . "'"); foreach ($this->backup_purchase_array as $backUpKey => $backUpRow) { $backUpRow['description_purchase'] = sprintf($backUpRow['description_purchase'], $variables[$sku]['idx0'], $variables[$sku]['idx1']); $purchase_data_array = null; if ($backUpRow['action'] == 'delete') { $result = $db->Execute("delete from " . TABLE_INVENTORY_PURCHASE . " where sku = '{$sku}' and vendor_id = '{$backUpRow['vendor_id']}'"); } else { if ($backUpRow['action'] == 'insert') { $purchase_data_array = $backUpRow; unset($purchase_data_array['id']); unset($purchase_data_array['action']); $purchase_data_array['sku'] = $sku; db_perform(TABLE_INVENTORY_PURCHASE, $purchase_data_array, 'insert'); } else { /*on purpose removed this part because iam not sure what to update and what not * $purchase_data_array = $backUpRow; unset($purchase_data_array['id']); unset($purchase_data_array['action']); foreach($backUpRow as $key => $value) { if($key == 'action' || $key == 'id' ) break; if($this->purchase_array[$backUpKey][$key] == $value){ unset($purchase_data_array[$key]); } } db_perform(TABLE_INVENTORY_PURCHASE, $purchase_data_array, 'update', "sku = '" . $sku. "' and vendor_id = '".$backUpRow['vendor_id']."'");*/ } } } } if (count($delete_list) && $security_level < 4) { $messageStack->add(ERROR_NO_PERMISSION, 'error'); $this->get_ms_list(); return false; } foreach ($delete_list as $sku) { $temp = $this->mi_check_remove($sku); if ($temp === true) { $result = $db->Execute("delete from " . TABLE_INVENTORY . " where sku = '{$sku}'"); $result = $db->Execute("delete from " . TABLE_INVENTORY_PURCHASE . " where sku = '{$sku}'"); } elseif ($temp === false) { $result = $db->Execute("update " . TABLE_INVENTORY . " set inactive = '1' where sku = '{$sku}'"); } } // update/insert into inventory_ms_list table $result = $db->Execute("select id from " . TABLE_INVENTORY_MS_LIST . " where sku = '{$this->sku}'"); $exists = $result->RecordCount(); $data_array = array('sku' => $this->sku, 'attr_0' => $this->ms_attr_0, 'attr_name_0' => $this->attr_name_0, 'attr_1' => $this->ms_attr_1, 'attr_name_1' => $this->attr_name_1); if ($exists) { db_perform(TABLE_INVENTORY_MS_LIST, $data_array, 'update', "id = " . $result->fields['id']); } else { db_perform(TABLE_INVENTORY_MS_LIST, $data_array, 'insert'); } $this->get_ms_list(); return true; }
<td> <input type = "text" name = "pid"></td></tr> <tr><td>Manufacturer Id</td> <td><input type = "text" name ="mid"></td></tr> <tr><td>Price</td> <td><input type = "text" name = "pr"></td><tr> <tr><td>Description</td> <td><input type ="text" name ="pd" cols = "3" rows ="5"></td></tr> <tr><td colspan="2" align="center"><input type ="submit" value= "Save"></td></tr> </form> </table> <?php if (isset($_REQUEST['pn'])) { include "inventory.php"; $obj = new inventory(); $equipment_name = $_REQUEST['pn']; $description = $_REQUEST['pd']; $equipment_id = $_REQUEST['pid']; $price = $_REQUEST['pr']; $manufacturer_id = $_REQUEST['mid']; if (!$obj->add_equipment($equipment_name, $description, $equipment_id, $price, $manufacturer_id)) { echo "Error adding" . mysql_error(); } else { echo " {$equipment_name} has successfully being added to the database"; } } ?> </table> </div>
<?php ini_set('max_execution_time', 600); //600 seconds = 10 minutes $inventory = new inventory(); $inventory->domain_id = 1; $message = $inventory->check_reorder_level(); try { //json //header('Content-type: application/json'); #echo encode::json( $message, 'pretty' ); //xml ob_end_clean(); header('Content-type: application/xml'); echo encode::xml($message); } catch (Exception $e) { echo $e->getMessage(); }
} if (isset($_POST['update'])) { $itNo = $_POST['itNo']; $title1 = $_POST['title1']; $stats1 = $_POST['stats1']; $type1 = $_POST['type1']; if (strlen($title1) < 1) { $addError[] = "Enter Title"; } elseif (strlen($itNo) < 1) { $addError[] = "Enter No."; } elseif (!isset($stats1)) { $addError[] = "Enter status"; } elseif (!isset($type1)) { $addError[] = "Enter type"; } else { $add = new inventory($type1, $itNo, $title1, $stats1); $add->insert(); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <meta name="description" content=""> <meta name="author" content=""> <title>Add Inventory</title>
<?php include '../view/sections/inventory-nav.php'; ?> <?php ?> <!-- panel start --> <hr> <div class="row"> <div class="col-lg-12"> <div class="panel panel-primary"> <div class="panel-heading"> <h1 class="panel-title text-center">মজুদ</h1> </div> <div class="panel-body"> <!-- panel body --> <?php include_once '../model/inventory.php'; inventory::show(1); ?> <div class="br"></div> </div> <!--panel body ends --> </div> </div> </div> <!-- panel ends --> <script type="text/javascript" src="js/inventoryScript.js"></script> <?php include 'template/blankEnd.php';
function get_item_by_sku($sku) { parent::get_item_by_sku($sku); $this->get_sr_list(); }
function search($keyword, $page = 1) { $toReturn = array(); $inventory = inventory::where('name', 'like', '%' . $keyword . '%')->orderBy('id', 'DESC')->take('20')->skip(20 * ($page - 1))->get()->toArray(); $toReturn['totalItems'] = inventory::where('name', 'like', '%' . $keyword . '%')->orderBy('id', 'DESC')->take('20')->skip(20 * ($page - 1))->count(); $teachers = User::where('role', 'teacher')->where('activated', '1')->get()->toArray(); $teacherArray = array(); while (list(, $value) = each($teachers)) { $teacherArray[$value['id']] = $value['fullName']; } $toReturn['inventory'] = array(); while (list(, $inventorry) = each($inventory)) { $toReturn['inventory'][] = array('id' => $inventorry['id'], "name" => $inventorry['name'], "inventorydate" => $inventorry['inventorydate'], "qty" => $inventorry['qty'], "total" => $inventorry['qty'], "status" => $inventorry['status'], "teachername" => isset($teacherArray[$inventorry['teacherId']]) ? $teacherArray[$inventorry['teacherId']] : ""); } return $toReturn; //////// }
* @version 5 * * @copyright Copyright (C) 2006 - 2014 Critter BVBA All rights reserved. * @license GNU General Public License version 3 or later; see license.txt * * showitem.inventory.php * * showitem.inventory dialog * */ // enable or disable logging error_reporting(E_ALL); ini_set('display_errors', '1'); // 0 - disabled; 1 - enabled // $o = new inventory($data->data->id); $o->details(); $sql = "SELECT `id`,`name` FROM `##_" . $_SESSION['space'] . "_inventory_item_type` WHERE `deleted`=0 AND `id`>0 ORDER BY `name`;"; $DBO->query($sql); $type = $DBO->result("objectlist"); $sql = "SELECT `id`,`name` FROM `##_" . $_SESSION['space'] . "_vat` WHERE `deleted`=0 AND `id`>0 ORDER BY `name`;"; $DBO->query($sql); $vat = $DBO->result("objectlist"); $sql = "SELECT `id`,CONCAT(`name`,' (',`sign`,')') AS `name` FROM `##_" . $_SESSION['space'] . "_currency` WHERE `deleted`=0 AND `id`>0 ORDER BY `name`;"; $DBO->query($sql); $curr = $DBO->result("objectlist"); ?> <div class="title"><?php echo ucwords($o->get("id") == -1 ? INVENTORY_NEW_INVENTORY : INVENTORY_EDIT_INVENTORY); ?> </div>
</ul> </div> <!-- end of tab2 div three_column--> </div> <!--end of tab3--> <div id="tabsLine-4" class="tabContent"> <div> <ul class="column header_field"> <li><?php $f->l_select_field_from_object('costing_org', org::find_all_inventory(), 'org', 'org', $inventory->costing_org, 'costing_org', '', '', $readonly); ?> </li> <li><?php $f->l_select_field_from_object('costing_method', inventory::costing_methods(), 'option_line_code', 'option_line_code', $inventory->costing_method, 'costing_method', '', '', $readonly); ?> </li> <li><?php $f->l_checkBox_field_d('transfer_to_gl_cb'); ?> </li> <li><?php $f->l_text_field_d('default_cost_group'); ?> </li> <li><?php $f->l_ac_field_d('material_ac_id', 'A'); ?> </li> <li><?php
<?php include_once "../../../includes/basics/basics.inc"; ?> <div id="json_inventory_ac_all"> <?php if (!empty($_GET['ship_to_inventory']) && ($_GET['find_account_details'] = 1)) { $org_id = $_GET['ship_to_inventory']; echo '<br/> in 1'; $in = new inventory(); $inventory_i = $in->findBy_org_id($org_id); $cc = new coa_combination(); echo '<div id="json_ap_accrual_ac_id">' . $cc->findBy_id($inventory_i->inv_ap_accrual_ac_id)->combination . '</div>'; echo '<div id="json_material_ac_id">' . $cc->findBy_id($inventory_i->material_ac_id)->combination . '</div>'; echo '<div id="json_inv_ppv_ac_id">' . $cc->findBy_id($inventory_i->inv_ppv_ac_id)->combination . '</div>'; } ?> </div>
// include_once FS_DIALOG . "showitem.access.default.php"; include_once FS_DIALOG . "showitem.access." . $_SESSION["space"] . ".php"; if (!isset($item)) { $item = new stdClass(); $item->id = -1; $item->name = ""; $item->description = ""; $item->volume = 0; $item->sku = ""; $item->field0 = ""; $item->price = 0; $item->inventory_item_id = -1; $item->inventory_item_name = ""; if (isset($data->data->inventory_item_id)) { $inventory = new inventory($data->data->inventory_item_id); $inventory->details(); $item->name = $inventory->get("name"); $item->description = $inventory->get("description"); $item->volume = 1; $item->field0 = $inventory->get("field0"); $item->sku = $inventory->get("sku"); $item->price = $inventory->get("indicative_price"); $item->inventory_item_id = $data->data->inventory_item_id; $item->vat_id = $inventory->get("vat_id"); $item->inventory_item_name = $inventory->get("name"); } } if (!isset($count)) { $count = 0; if (isset($data->data->count)) {
<?php require_once 'common/init.php'; $inventorty = new inventory(); if (isset($_GET['bc'])) { $barcode = $_GET['bc']; $product = $inventorty->get_product($barcode); if ($product) { $_SESSION['barcode'] = $barcode; $_SESSION['barcode_detail'] = $product; print_f($_SESSION['barcode_detail']); } else { echo 'Error'; } }
<?php if ($_POST['op'] == 'add' and !empty($_POST['product_id'])) { $inventory = new inventory(); $inventory->domain_id = domain_id::get(); $inventory->product_id = $_POST['product_id']; $inventory->quantity = $_POST['quantity']; $inventory->cost = $_POST['cost']; $inventory->date = $_POST['date']; $inventory->note = $_POST['note']; $result = $inventory->insert(); $saved = !empty($result) ? "true" : "false"; } $productobj = new product(); $product_all = $productobj->get_all(); $smarty->assign('product_all', $product_all); $smarty->assign('saved', $saved); $smarty->assign('pageActive', 'inventory'); $smarty->assign('subPageActive', 'inventory_add'); $smarty->assign('active_tab', '#product');
<?php require_once 'common/init.php'; $inventory = new inventory(); $ID = isset($_GET['id']) ? $_GET['id'] : NULL; if (isset($_POST['add_inventory'])) { // Update old record if (isset($ID)) { $results = $inventory->inv_update($_POST, $ID); } else { // Insert new $results = $inventory->inv_insert($_POST); } if ($results) { echo 'Success'; } else { echo 'Error'; } } if (isset($ID)) { $inventory_result = $inventory->inv_get($ID); } ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Add Inventroy</title> </head> <body>
public function create_inventory($name, $type = inventory::TYPE_GENERAL) { return inventory::create($name, $type, $this); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $data['inventory'] = inventory::all(); return view('inventory.list', $data); }
function __construct() { parent::__construct(); }