begin_transaction();
hook_db_prewrite($po, ST_SUPPRECEIVE);
- add_new_exchange_rate(get_supplier_currency($po->supplier_id), $date_, $po->ex_rate);
+ if (!is_company_currency($po->curr_code))
+ {
+ if (!$po->ex_rate)
+ $po->ex_rate = get_date_exchange_rate($po->curr_code, $date_);
+ else
+ add_new_exchange_rate($po->curr_code, $date_, $po->ex_rate);
+ } else
+ $po->ex_rate = 1;
$grn = add_grn_batch($po->order_no, $po->supplier_id, $po->reference, $po->Location, $date_, $po->ex_rate);
`reference` varchar(60) NOT NULL default '',
`delivery_date` date NOT NULL default '0000-00-00',
`loc_code` varchar(5) default NULL,
+ `rate` double NULL default '1'
PRIMARY KEY (`id`),
KEY `delivery_date` (`delivery_date`),
KEY `purch_order_no` (`purch_order_no`)
-- Dumping data for table `0_grn_batch`
--
-INSERT INTO `0_grn_batch` VALUES(1, 2, 1, '1', '2014-06-21', 'DEF');
+INSERT INTO `0_grn_batch` VALUES(1, 2, 1, '1', '2014-06-21', 'DEF', '1');
-- --------------------------------------------------------
`reference` varchar(60) NOT NULL default '',
`delivery_date` date NOT NULL default '0000-00-00',
`loc_code` varchar(5) default NULL,
+ `rate` double NULL default '1',
PRIMARY KEY (`id`),
KEY `delivery_date` (`delivery_date`),
KEY `purch_order_no` (`purch_order_no`)