__PACKAGE__->meta->table('inventory');
__PACKAGE__->meta->columns(
- bestbefore => { type => 'date' },
- bin_id => { type => 'integer', not_null => 1 },
- chargenumber => { type => 'text', default => '', not_null => 1 },
- comment => { type => 'text' },
- employee_id => { type => 'integer', not_null => 1 },
- id => { type => 'serial', not_null => 1 },
- itime => { type => 'timestamp', default => 'now()' },
- mtime => { type => 'timestamp' },
- oe_id => { type => 'integer' },
- orderitems_id => { type => 'integer' },
- parts_id => { type => 'integer', not_null => 1 },
- project_id => { type => 'integer' },
- qty => { type => 'numeric', precision => 25, scale => 5 },
- shippingdate => { type => 'date' },
- trans_id => { type => 'integer', not_null => 1 },
- trans_type_id => { type => 'integer', not_null => 1 },
- warehouse_id => { type => 'integer', not_null => 1 },
+ bestbefore => { type => 'date' },
+ bin_id => { type => 'integer', not_null => 1 },
+ chargenumber => { type => 'text', default => '', not_null => 1 },
+ comment => { type => 'text' },
+ delivery_order_items_stock_id => { type => 'integer' },
+ employee_id => { type => 'integer', not_null => 1 },
+ id => { type => 'serial', not_null => 1 },
+ itime => { type => 'timestamp', default => 'now()' },
+ mtime => { type => 'timestamp' },
+ oe_id => { type => 'integer' },
+ parts_id => { type => 'integer', not_null => 1 },
+ project_id => { type => 'integer' },
+ qty => { type => 'numeric', precision => 25, scale => 5 },
+ shippingdate => { type => 'date' },
+ trans_id => { type => 'integer', not_null => 1 },
+ trans_type_id => { type => 'integer', not_null => 1 },
+ warehouse_id => { type => 'integer', not_null => 1 },
);
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
key_columns => { bin_id => 'id' },
},
+ delivery_order_items_stock => {
+ class => 'SL::DB::DeliveryOrderItemsStock',
+ key_columns => { delivery_order_items_stock_id => 'id' },
+ },
+
employee => {
class => 'SL::DB::Employee',
key_columns => { employee_id => 'id' },
},
+ oe => {
+ class => 'SL::DB::DeliveryOrder',
+ key_columns => { oe_id => 'id' },
+ },
+
parts => {
class => 'SL::DB::Part',
key_columns => { parts_id => 'id' },
conv_i($form->{"delivery_order_items_id_$i"}), $sinfo->{qty}, $sinfo->{unit}, conv_i($sinfo->{warehouse_id}),
conv_i($sinfo->{bin_id}));
$h_item_stock_id->finish();
+ # write back the id to the form (important if only transfer was clicked (id fk for invoice)
+ $form->{"stock_${in_out}_$i"} = YAML::Dump($stock_info);
}
@values = ($form->{"delivery_order_items_id_$i"}, $sinfo->{qty}, $sinfo->{unit}, conv_i($sinfo->{warehouse_id}),
conv_i($sinfo->{bin_id}), $sinfo->{chargenumber}, conv_date($sinfo->{bestbefore}),
name_prefix => 'ic_',
name_postfix => "_$i",
dbh => $dbh);
- # link order items with doi
+ # link order items with doi, for future extension look at foreach IS.pm
if ($form->{"converted_from_orderitems_id_$i"}) {
RecordLinks->create_links('dbh' => $dbh,
'mode' => 'ids',
foreach my $request (@{ $params{requests} }) {
push @transfers, {
- 'parts_id' => $request->{parts_id},
- "${prefix}_warehouse_id" => $request->{warehouse_id},
- "${prefix}_bin_id" => $request->{bin_id},
- 'chargenumber' => $request->{chargenumber},
- 'bestbefore' => $request->{bestbefore},
- 'qty' => $request->{qty},
- 'unit' => $request->{unit},
- 'oe_id' => $form->{id},
- 'shippingdate' => 'current_date',
- 'transfer_type' => $params{direction} eq 'in' ? 'stock' : 'shipped',
- 'project_id' => $request->{project_id},
+ 'parts_id' => $request->{parts_id},
+ "${prefix}_warehouse_id" => $request->{warehouse_id},
+ "${prefix}_bin_id" => $request->{bin_id},
+ 'chargenumber' => $request->{chargenumber},
+ 'bestbefore' => $request->{bestbefore},
+ 'qty' => $request->{qty},
+ 'unit' => $request->{unit},
+ 'oe_id' => $form->{id},
+ 'shippingdate' => 'current_date',
+ 'transfer_type' => $params{direction} eq 'in' ? 'stock' : 'shipped',
+ 'project_id' => $request->{project_id},
+ 'delivery_order_items_stock_id' => $request->{delivery_order_items_stock_id},
};
}