public function save() { $ship = Shipments::get_shipment(); $ship = new Shipments(); $ship -> vaccine_id = $this -> input -> post("combo2"); $ship -> task_id = $this -> input -> post("combo1"); $test_initiate_date=strtotime($this -> input -> post("start_date")); $ship -> Initiate_date = date('Y-m-d',$test_initiate_date); $test_start_date=strtotime($this -> input -> post("receive_date")); $ship -> receive_date = date('Y-m-d',$test_start_date); $test_end_date=strtotime($this -> input -> post("end_date")); $ship -> end_date = date('Y-m-d',$test_end_date); $ship -> Initiator_name = $this -> input -> post("name"); $ship -> save(); $this->index() ; }
public function save() { $ship = Shipments::get_shipment(); $ship = new Shipments(); //picks values eneterd in the add_task_view //picks the vaccines_id and the task_id and populates the task and vaccine name drop down $ship->vaccine_id = $this->input->post("combo2"); $ship->task_id = $this->input->post("combo1"); //formatting the dates from the date picker //Initiate Date $test_initiate_date = strtotime($this->input->post("start_date")); $ship->Initiate_date = date('Y-m-d', $test_initiate_date); //Receive Date $test_start_date = strtotime($this->input->post("start_date")); $test_start_date = strtotime("+7 day", $test_start_date); $ship->expected_end_date = date('Y-m-d', $test_start_date); //End Date $test_end_date = strtotime($this->input->post("end_date")); $ship->end_date = date('Y-m-d', $test_end_date); //Initiator Name $ship->Initiator_name = $this->input->post("name"); $ship->save(); $this->index(); }
/** * Store a newly created resource in storage. * * @return Response */ public function storeDirectShipment() { $id = Input::json('channel_name'); $channel_name_tbl = $this->getChannelName($id); $id = Input::json('warehouse'); $warehouse_name_tbl = $this->getWarehouseName($id); // Insert New jobs Details in jobs Table $jobs_dtl = new Jobs(); $jobs_dtl->Channel_Id = Input::json('channel_name'); $jobs_dtl->Job_Type_Id = "4"; $jobs_dtl->Job_Status_Id = "4"; $jobs_dtl->ACTIVE = 1; $jobs_dtl->CREATE_TS = date("Y-m-d H:i:s"); $jobs_dtl->MODIFY_TS = date("Y-m-d H:i:s"); $jobs_dtl->save(); // Insert New Shipments Details in Shipments Table $shipment_dtl = new Shipments(); $shipment_dtl->Job_Id = $jobs_dtl->Job_Id; $shipment_dtl->Date_Of_Shipment = Input::json('date_of_shipment'); $shipment_dtl->Channel_Name = $channel_name_tbl; $shipment_dtl->Warehouse_Id = Input::json('warehouse'); $shipment_dtl->Warehouse_Name = $warehouse_name_tbl; $shipment_dtl->Carrier_Id = Input::json('carrier_name'); $shipment_dtl->CarrierService_Id = Input::json('carrier_service_name'); $shipment_dtl->RecipientName = Input::json('recipient_name'); $shipment_dtl->ShipAddress1 = Input::json('shippingaddress'); $shipment_dtl->ShipAddress2 = Input::json('shippingaddress2'); $shipment_dtl->ShipCountry = Input::json('shipcountry'); $shipment_dtl->ShipState = Input::json('shipstate'); $shipment_dtl->ShipCity = Input::json('shipcity'); $shipment_dtl->ShipZip = Input::json('shipzip'); $shipment_dtl->ShipEmail = Input::json('ship_email'); $shipment_dtl->ShippingAccount = Input::json('shipping_account'); $shipment_dtl->TrackingNumber = Input::json('tracking_number'); $shipment_dtl->ShipmentCost = Input::json('shipment_cost'); $shipment_dtl->SignatureRequired = Input::json('signature_required'); $shipment_dtl->EmailNotification = Input::json('email_notification'); $shipment_dtl->ActualShipmentCost = Input::json('actual_shipment_cost'); $shipment_dtl->AdditionalNotes = Input::json('additional_notes'); $shipment_dtl->ACTIVE = 1; $shipment_dtl->CREATE_TS = date("Y-m-d H:i:s"); $shipment_dtl->MODIFY_TS = date("Y-m-d H:i:s"); $shipment_dtl->save(); //Particular Shipment Qty Details $order_item_count = Input::json('item_count'); $deleted_item_array = array(); $deleted_item_array = Input::json('deleted_item_list'); for ($i = 1; $i <= $order_item_count; $i++) { if (!in_array($i, $deleted_item_array)) { if (isset(Input::json('order_item')['order_item' . $i])) { $prod_list = $this->getProductDetailsByProductId(Input::json('order_item')['order_item' . $i]); $itm_id = Input::json('order_item')['order_item' . $i]; $channel_id = Input::json('channel_name'); $warehouse_ids = Input::json('warehouse'); $inventory_id = $this->getInventoryIDByProdId($itm_id, $warehouse_ids, $channel_id); $inv_id = $inventory_id[0]->InventoryItem_Id; $stock_count = $inventory_id[0]->Stock_Count; $order_shb_item_dtl = new ShipmentItems(); $order_shb_item_dtl->Shipment_Id = $shipment_dtl->Shipment_Id; $order_shb_item_dtl->Inventory_Item_Id = $inv_id; $order_shb_item_dtl->ItemName = $prod_list[0]->Product_Name; $order_shb_item_dtl->Order_Qty = Input::json('order_qty')['order_qty' . $i]; $order_shb_item_dtl->Shipment_Qty = Input::json('shipping_qty')['shipping_qty' . $i]; $order_shb_item_dtl->Ship_Balance_Qty = Input::json('shipping_qty')['shipping_qty' . $i]; $order_shb_item_dtl->CREATE_TS = date("Y-m-d H:i:s"); $order_shb_item_dtl->MODIFY_TS = date("Y-m-d H:i:s"); $order_shb_item_dtl->save(); $bal_qty = Input::json('avilable_qty')['avilable_qty' . $i] - Input::json('shipping_qty')['shipping_qty' . $i]; $this->updateStockCountInventoryItems($bal_qty, $inv_id); $inv_log_dtl = new InventoryItemLog(); $inv_log_dtl->Job_Id = $jobs_dtl->Job_Id; $inv_log_dtl->InventoryItem_Id = $inv_id; $inv_log_dtl->Product_Id = Input::json('order_item')['order_item' . $i]; $inv_log_dtl->Channel_Id = Input::json('channel_name'); $inv_log_dtl->Warehouse_Id = Input::json('warehouse'); $inv_log_dtl->Stock_Count = $bal_qty; $inv_log_dtl->Re_Order_Level = "0"; $inv_log_dtl->Notes = ""; $inv_log_dtl->Reason = ""; $inv_log_dtl->LastCycleCount = "0"; $inv_log_dtl->LastAdjustmentCount = "0"; $inv_log_dtl->Active = 1; $inv_log_dtl->Create_ts = date("Y-m-d H:i:s"); $inv_log_dtl->Modify_ts = date("Y-m-d H:i:s"); $inv_log_dtl->save(); } } } return Response::json(array('Response' => $shipment_dtl->id, 'flash' => 'Save Successfully!!!!!')); }