fixed quantities on items import

This commit is contained in:
Curt Hauta
2014-11-05 20:01:25 -07:00
parent cc9adeef47
commit 8ae21bbcb7
2 changed files with 35 additions and 18 deletions

View File

@@ -512,27 +512,27 @@ class Items extends Secure_area implements iData_controller
$i=1;
while (($data = fgetcsv($handle)) !== FALSE)
{
$item_data = array(
'name' => $data[1],
'description' => $data[13],
'description' => $data[11],
'category' => $data[2],
'cost_price' => $data[4],
'unit_price' => $data[5],
'quantity' => $data[10],
'reorder_level' => $data[11],
'reorder_level' => $data[10],
'supplier_id' => $this->Supplier->exists($data[3]) ? $data[3] : null,
'allow_alt_description' => $data[14] != '' ? '1' : '0',
'is_serialized' => $data[15] != '' ? '1' : '0',
'custom1' => $data[16], /** GARRISON ADDED 5/6/2013 **/
'custom2' => $data[17], /** GARRISON ADDED 5/6/2013 **/
'custom3' => $data[18], /** GARRISON ADDED 5/6/2013 **/
'custom4' => $data[19], /** GARRISON ADDED 5/6/2013 **/
'custom5' => $data[20], /** GARRISON ADDED 5/6/2013 **/
'custom6' => $data[21], /** GARRISON ADDED 5/6/2013 **/
'custom7' => $data[22], /** GARRISON ADDED 5/6/2013 **/
'custom8' => $data[23], /** GARRISON ADDED 5/6/2013 **/
'custom9' => $data[24], /** GARRISON ADDED 5/6/2013 **/
'custom10' => $data[25] /** GARRISON ADDED 5/6/2013 **/
'allow_alt_description' => $data[12] != '' ? '1' : '0',
'is_serialized' => $data[13] != '' ? '1' : '0',
'custom1' => $data[14], /** GARRISON ADDED 5/6/2013 **/
'custom2' => $data[15], /** GARRISON ADDED 5/6/2013 **/
'custom3' => $data[16], /** GARRISON ADDED 5/6/2013 **/
'custom4' => $data[17], /** GARRISON ADDED 5/6/2013 **/
'custom5' => $data[18], /** GARRISON ADDED 5/6/2013 **/
'custom6' => $data[19], /** GARRISON ADDED 5/6/2013 **/
'custom7' => $data[20], /** GARRISON ADDED 5/6/2013 **/
'custom8' => $data[21], /** GARRISON ADDED 5/6/2013 **/
'custom9' => $data[22], /** GARRISON ADDED 5/6/2013 **/
'custom10' => $data[23] /** GARRISON ADDED 5/6/2013 **/
);
$item_number = $data[0];
@@ -561,6 +561,23 @@ class Items extends Secure_area implements iData_controller
{
$this->Item_taxes->save($items_taxes_data, $item_data['item_id']);
}
// quantities
$cols = count($data);
for ($col = 24; $col < $cols; $col = $col + 2)
{
$item_quantity_data = array(
'item_id' => $item_data['item_id'],
'location_id' => $data[$col],
'quantity' => $data[$col + 1],
);
$this->Item_quantities->save($item_quantity_data, $data[$col], $data[$col + 1]);
}
// Inventory Info
$employee_id=$this->Employee->get_logged_in_employee_info()->person_id;
$emp_info=$this->Employee->get_info($employee_id);
@@ -623,4 +640,4 @@ class Items extends Secure_area implements iData_controller
}
}
?>
?>

View File

@@ -1,2 +1,2 @@
UPC/EAN/ISBN,Item Name,Category,Supplier ID,Cost Price,Unit Price,Tax 1 Name,Tax 1 Percent,Tax 2 Name ,Tax 2 Percent,Quantity,Reorder Level,Location,Description,Allow Alt Description,Item has Serial Number,custom1,custom2,custom3,custom4,custom5,custom6,custom7,custom8,custom9,custom10
33333333,Apple iMac,Computers,,800,1200,Tax 1,8,Tax 2,10,10,1,Earth,Best Computer ever,y,,"Oz, Frank",The Bunny and the Hill,"Monkeys,Giraffes,Gorillas",English,New,Apple,,1999,D3lk3jlkjs,Hardbound
UPC/EAN/ISBN,Item Name,Category,Supplier ID,Cost Price,Unit Price,Tax 1 Name,Tax 1 Percent,Tax 2 Name ,Tax 2 Percent,Reorder Level,Description,Allow Alt Description,Item has Serial Number,custom1,custom2,custom3,custom4,custom5,custom6,custom7,custom8,custom9,custom10,location_id,quantity
33333333,Apple iMac,Computers,,800,1200,Tax 1,8,Tax 2,10,1,Best Computer ever,y,,"Oz, Frank",The Bunny and the Hill,"Monkeys,Giraffes,Gorillas",English,New,Apple,,1999,D3lk3jlkjs,Hardbound,8,100
1 UPC/EAN/ISBN Item Name Category Supplier ID Cost Price Unit Price Tax 1 Name Tax 1 Percent Tax 2 Name Tax 2 Percent Quantity Reorder Level Description Location Allow Alt Description Item has Serial Number custom1 custom2 custom3 custom4 custom5 custom6 custom7 custom8 custom9 custom10 location_id quantity
2 33333333 Apple iMac Computers 800 1200 Tax 1 8 Tax 2 10 10 1 Best Computer ever Earth y Oz, Frank The Bunny and the Hill Monkeys,Giraffes,Gorillas English New Apple 1999 D3lk3jlkjs Hardbound 8 100