public static function save_rtk_commodities($data_array) { $o = new Rtk_Fcdrr_Order_Details(); $o->fromArray($data_array); $o->save(); return TRUE; }
public function post_fcdrr() { date_default_timezone_set('EUROPE/Moscow'); $facility_c = $this->session->userdata('news'); $order_date = date('Y-m-d'); $facility_code = $_POST['facility_code']; $begin_date = $_POST['begin_date']; $end_date = $_POST['end_date']; $commodity_id = $_POST['commodity_id']; $beginning_balance = $_POST['beginning_bal']; $warehouse_quantity_received = $_POST['qty_warehouse']; $warehouse_lot_no = $_POST['lot_No_warehouse']; $other_quantity_received = $_POST['qty_other']; $other_lot_no = $_POST['lot_No_other']; $quantity_used = $_POST['qty_used']; $loss = $_POST['loss']; $positive_adj = $_POST['positive_adj']; $negative_adj = $_POST['negative_adj']; $physical_count = $_POST['ending_bal']; $quantity_requested = $_POST['qty_requested']; for ($i = 0; $i < count($commodity_id); $i++) { $mydata = array('facility_code' => $facility_code, 'order_date' => $order_date, 'begin_date' => $begin_date, 'end_date' => $end_date, 'commodity_id' => $commodity_id[$i], 'beginning_balance' => $beginning_balance[$i], 'warehouse_quantity_received' => $warehouse_quantity_received[$i], 'warehouse_lot_no' => $warehouse_lot_no[$i], 'other_quantity_received' => $other_quantity_received[$i], 'other_lot_no' => $other_lot_no[$i], 'quantity_used' => $quantity_used[$i], 'loss' => $loss[$i], 'positive_adj' => $positive_adj[$i], 'negative_adj' => $negative_adj[$i], 'physical_count' => $physical_count[$i], 'quantity_requested' => $quantity_requested[$i]); Rtk_Fcdrr_Order_Details::save_rtk_commodities($mydata); } }