Example #1
0
        public void UpdateCostHistory(DataRow pdrowReturnedGoodsDetail, bool blnNewReturnedGood, SO_ReturnedGoodsMasterVO pobjSO_ReturnedGoodsMasterVO, decimal pdcmAvgCost)
        {
            const string RETURNED_GOODS_TRANSACTION_NAME = "SOReturnGoodsReceive";

            if (blnNewReturnedGood && pdrowReturnedGoodsDetail.RowState == DataRowState.Deleted)
            {
                //in case of adding a new returned goods
                //we don't care the deleted record
                //we only care the other states : Modified and AddNew
                return;
            }
            IV_CostHistoryVO objIV_CostHistoryVO = new IV_CostHistoryVO();

            if (pdcmAvgCost < 0)
            {
                pdcmAvgCost = 0;
            }
            objIV_CostHistoryVO.ICDHItemCost21 = pdcmAvgCost;
            objIV_CostHistoryVO.ReceiveDate    = pobjSO_ReturnedGoodsMasterVO.TransDate;
            objIV_CostHistoryVO.ReceiveRef     = pobjSO_ReturnedGoodsMasterVO.ReturnedGoodsMasterID;
            objIV_CostHistoryVO.ReceiveRefLine = int.Parse(pdrowReturnedGoodsDetail[SO_ReturnedGoodsDetailTable.RETURNEDGOODSDETAILID_FLD].ToString());
            //QA Status
            if (pdrowReturnedGoodsDetail[SO_ReturnedGoodsDetailTable.QASTATUS_FLD].ToString().Trim() != String.Empty)
            {
                objIV_CostHistoryVO.QAStatus = int.Parse(pdrowReturnedGoodsDetail[SO_ReturnedGoodsDetailTable.QASTATUS_FLD].ToString());
            }
            else
            {
                objIV_CostHistoryVO.QAStatus = 0;
            }
            //Party ID
            objIV_CostHistoryVO.PartyID = pobjSO_ReturnedGoodsMasterVO.PartyID;
            //Party Location
            objIV_CostHistoryVO.PartyLocationID = pobjSO_ReturnedGoodsMasterVO.PartyLocationID;
            //Master Location
            objIV_CostHistoryVO.MasterLocationID = int.Parse(pdrowReturnedGoodsDetail[SO_ReturnedGoodsDetailTable.MASTERLOCATIONID_FLD].ToString());
            //Product ID
            objIV_CostHistoryVO.ProductID = int.Parse(pdrowReturnedGoodsDetail[SO_ReturnedGoodsDetailTable.PRODUCTID_FLD].ToString());
            //CCN ID
            objIV_CostHistoryVO.CCNID = pobjSO_ReturnedGoodsMasterVO.CCNID;
            //Unit of measure
            if (pdrowReturnedGoodsDetail[SO_ReturnedGoodsDetailTable.UNITID_FLD].ToString().Trim() != String.Empty)
            {
                objIV_CostHistoryVO.StockUMID = int.Parse(pdrowReturnedGoodsDetail[SO_ReturnedGoodsDetailTable.UNITID_FLD].ToString());
            }
            //get the TransType ID
            MST_TranTypeDS objMST_TranTypeDS = new MST_TranTypeDS();

            objIV_CostHistoryVO.TranTypeID = objMST_TranTypeDS.GetIDFromCode(RETURNED_GOODS_TRANSACTION_NAME);

            //Insert this record into the IV_CostHistory
            IV_CostHistoryDS objIV_CostHistoryDS = new IV_CostHistoryDS();

            objIV_CostHistoryDS.AddReturnedGoods(objIV_CostHistoryVO);
        }
Example #2
0
        public void UpdateCostHistory(DataRow pdrowReturnedGoodsDetail, bool blnNewReturnedGood, PO_ReturnToVendorMasterVO pobjPO_ReturnToVendorMasterVO)
        {
            const string RETURNED_GOODS_TRANSACTION_NAME = "POReturnToVendor";

            try
            {
                IV_CostHistoryVO objIV_CostHistoryVO = new IV_CostHistoryVO();

                objIV_CostHistoryVO.ReceiveDate    = pobjPO_ReturnToVendorMasterVO.PostDate;
                objIV_CostHistoryVO.ReceiveRef     = pobjPO_ReturnToVendorMasterVO.ReturnToVendorMasterID;
                objIV_CostHistoryVO.ReceiveRefLine = int.Parse(pdrowReturnedGoodsDetail[PO_ReturnToVendorDetailTable.RETURNTOVENDORDETAILID_FLD].ToString());
                //QA Status
                objIV_CostHistoryVO.QAStatus = 0;
                //Party ID
                objIV_CostHistoryVO.PartyID = pobjPO_ReturnToVendorMasterVO.PartyID;
                //Master Location
                objIV_CostHistoryVO.MasterLocationID = pobjPO_ReturnToVendorMasterVO.MasterLocationID;
                //Product ID
                objIV_CostHistoryVO.ProductID = int.Parse(pdrowReturnedGoodsDetail[PO_ReturnToVendorDetailTable.PRODUCTID_FLD].ToString());
                //CCN ID
                objIV_CostHistoryVO.CCNID = pobjPO_ReturnToVendorMasterVO.CCNID;
                //Unit of measure
                if (pdrowReturnedGoodsDetail[PO_ReturnToVendorDetailTable.BUYINGUMID_FLD].ToString().Trim() != String.Empty)
                {
                    objIV_CostHistoryVO.StockUMID = int.Parse(pdrowReturnedGoodsDetail[PO_ReturnToVendorDetailTable.BUYINGUMID_FLD].ToString());
                }
                //get the TransType ID
                MST_TranTypeDS objMST_TranTypeDS = new MST_TranTypeDS();
                objIV_CostHistoryVO.TranTypeID = objMST_TranTypeDS.GetIDFromCode(RETURNED_GOODS_TRANSACTION_NAME);

                //Insert this record into the IV_CostHistory
                IV_CostHistoryDS objIV_CostHistoryDS = new IV_CostHistoryDS();
                objIV_CostHistoryDS.AddReturnedGoods(objIV_CostHistoryVO);
            }
            catch (PCSDBException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }