private bool Delete() { bool boRetValue = false; string stIDs = ""; foreach(DataListItem item in lstItem.Items) { HtmlInputCheckBox chkList = (HtmlInputCheckBox) item.FindControl("chkList"); if (chkList!=null) { if (chkList.Checked == true) { stIDs += chkList.Value + ","; boRetValue = true; } } } if (boRetValue) { // Aug 1, 2011 : Lemu // Remove the entire code and replaced with the code below to cater InventoryAdjustment and ProductMovement // See _Product/_variationsMatrix/_List.cs.Delete // // ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(); // clsProductVariationsMatrix.Delete(stIDs.Substring(0,stIDs.Length-1)); // clsProductVariationsMatrix.SynchronizeQuantity(Convert.ToInt64(lblProductID.Text)); // clsProductVariationsMatrix.CommitAndDispose(); Security.AccessUserDetails clsAccessUserDetails = (Security.AccessUserDetails)Session["AccessUserDetails"]; ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(); clsProductVariationsMatrix.GetConnection(); Products clsProducts = new Products(clsProductVariationsMatrix.Connection, clsProductVariationsMatrix.Transaction); long ProductID = Int64.Parse(lblProductID.Text); string[] strIDs = stIDs.Substring(0, stIDs.Length - 1).Split(','); foreach (string ID in strIDs) { long MatrixID = long.Parse(ID); ProductDetails clsDetails = clsProducts.Details(ProductID: ProductID, MatrixID: MatrixID); InvAdjustmentDetails clsInvAdjustmentDetails = new InvAdjustmentDetails(); clsInvAdjustmentDetails.UID = clsAccessUserDetails.UID; clsInvAdjustmentDetails.InvAdjustmentDate = DateTime.Now; clsInvAdjustmentDetails.ProductID = clsDetails.ProductID; clsInvAdjustmentDetails.ProductCode = clsDetails.ProductCode; clsInvAdjustmentDetails.Description = clsDetails.ProductDesc; clsInvAdjustmentDetails.VariationMatrixID = clsDetails.MatrixID; clsInvAdjustmentDetails.MatrixDescription = clsDetails.MatrixDescription; clsInvAdjustmentDetails.UnitID = clsDetails.BaseUnitID; clsInvAdjustmentDetails.UnitCode = clsDetails.BaseUnitCode; clsInvAdjustmentDetails.QuantityBefore = clsDetails.Quantity; clsInvAdjustmentDetails.QuantityNow = 0; clsInvAdjustmentDetails.MinThresholdBefore = clsDetails.MinThreshold; clsInvAdjustmentDetails.MinThresholdNow = 0; clsInvAdjustmentDetails.MaxThresholdBefore = clsDetails.MaxThreshold; clsInvAdjustmentDetails.MaxThresholdNow = 0; clsInvAdjustmentDetails.Remarks = "deleted item."; InvAdjustment clsInvAdjustment = new InvAdjustment(clsProducts.Connection, clsProducts.Transaction); clsInvAdjustment.Insert(clsInvAdjustmentDetails); clsProducts.SubtractQuantity(Constants.BRANCH_ID_MAIN, clsDetails.ProductID, clsDetails.MatrixID, clsDetails.Quantity, Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(PRODUCT_INVENTORY_MOVEMENT.DEDUCT_PRODUCT_VARIATION_DELETE) + " : " + clsDetails.MatrixDescription, clsInvAdjustmentDetails.InvAdjustmentDate, "SYS-VARDEL" + clsInvAdjustmentDetails.InvAdjustmentDate.ToString("yyyyMMddHHmmss"), clsAccessUserDetails.Name); clsProductVariationsMatrix.Delete(long.Parse(ID)); } clsProductVariationsMatrix.CommitAndDispose(); } return boRetValue; }
private void SubtractItemToInventory(long SOID) { SODetails clsSODetails = Details(SOID); ERPConfig clsERPConfig = new ERPConfig(base.Connection, base.Transaction); ERPConfigDetails clsERPConfigDetails = clsERPConfig.Details(); SOItem clsSOItem = new SOItem(base.Connection, base.Transaction); ProductUnit clsProductUnit = new ProductUnit(base.Connection, base.Transaction); Products clsProduct = new Products(base.Connection, base.Transaction); ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(base.Connection, base.Transaction); ProductPackage clsProductPackage = new ProductPackage(base.Connection, base.Transaction); MatrixPackage clsMatrixPackage = new MatrixPackage(base.Connection, base.Transaction); Inventory clsInventory = new Inventory(base.Connection, base.Transaction); InventoryDetails clsInventoryDetails; //MatrixPackagePriceHistoryDetails clsMatrixPackagePriceHistoryDetails; //ProductPackagePriceHistoryDetails clsProductPackagePriceHistoryDetails; System.Data.DataTable dt = clsSOItem.ListAsDataTable(SOID, "SOItemID", SortOption.Ascending); foreach (System.Data.DataRow dr in dt.Rows) { long lngProductID = long.Parse(dr["ProductID"].ToString()); int intProductUnitID = int.Parse(dr["ProductUnitID"].ToString()); decimal decItemQuantity = decimal.Parse(dr["Quantity"].ToString()); decimal decQuantity = clsProductUnit.GetBaseUnitValue(lngProductID, intProductUnitID, decItemQuantity); long lngVariationMatrixID = long.Parse(dr["VariationMatrixID"].ToString()); string strMatrixDescription = "" + dr["MatrixDescription"].ToString(); string strProductCode = "" + dr["ProductCode"].ToString(); decimal decUnitCost = decimal.Parse(dr["UnitCost"].ToString()); decimal decItemCost = decimal.Parse(dr["Amount"].ToString()); decimal decVAT = decimal.Parse(dr["VAT"].ToString()); ///******************************************* // * Add in the Sales Price History // * ****************************************/ //if (lngVariationMatrixID != 0) //{ // // Update MatrixPackagePriceHistory first to get the history // clsMatrixPackagePriceHistoryDetails = new MatrixPackagePriceHistoryDetails(); // clsMatrixPackagePriceHistoryDetails.UID = clsSODetails.SellerID; // clsMatrixPackagePriceHistoryDetails.PackageID = clsMatrixPackage.GetPackageID(lngVariationMatrixID, intProductUnitID); // clsMatrixPackagePriceHistoryDetails.ChangeDate = DateTime.Now; // clsMatrixPackagePriceHistoryDetails.Price = decUnitCost; // clsMatrixPackagePriceHistoryDetails.PurchasePrice = -1; //-1 = nochange // clsMatrixPackagePriceHistoryDetails.VAT = -1; //-1 = nochange // clsMatrixPackagePriceHistoryDetails.EVAT = -1; //-1 = nochange // clsMatrixPackagePriceHistoryDetails.LocalTax = -1; //-1 = nochange // clsMatrixPackagePriceHistoryDetails.Remarks = "Based on SO #: " + clsSODetails.SONo; // MatrixPackagePriceHistory clsMatrixPackagePriceHistory = new MatrixPackagePriceHistory(base.Connection, base.Transaction); // clsMatrixPackagePriceHistory.Insert(clsMatrixPackagePriceHistoryDetails); //} //else //{ // // Update ProductPackagePriceHistory first to get the history // clsProductPackagePriceHistoryDetails = new ProductPackagePriceHistoryDetails(); // clsProductPackagePriceHistoryDetails.UID = clsSODetails.SellerID; // clsProductPackagePriceHistoryDetails.PackageID = clsProductPackage.GetPackageID(lngProductID, intProductUnitID); // clsProductPackagePriceHistoryDetails.ChangeDate = DateTime.Now; // clsProductPackagePriceHistoryDetails.Price = decUnitCost; // clsProductPackagePriceHistoryDetails.PurchasePrice = -1; //-1 = nochange // clsProductPackagePriceHistoryDetails.VAT = -1; //-1 = nochange // clsProductPackagePriceHistoryDetails.EVAT = -1; //-1 = nochange // clsProductPackagePriceHistoryDetails.LocalTax = -1; //-1 = nochange // clsProductPackagePriceHistoryDetails.Remarks = "Based on SO #: " + clsSODetails.SONo; // ProductPackagePriceHistory clsProductPackagePriceHistory = new ProductPackagePriceHistory(base.Connection, base.Transaction); // clsProductPackagePriceHistory.Insert(clsProductPackagePriceHistoryDetails); //} /******************************************* * Subtract to Inventory * ****************************************/ // clsProduct.SubtractQuantity(lngProductID, decQuantity); // if (lngVariationMatrixID != 0) { clsProductVariationsMatrix.SubtractQuantity(lngVariationMatrixID, decQuantity); } // July 28, 2011: change the above codes to the following clsProduct.SubtractQuantity(clsSODetails.BranchID, lngProductID, lngVariationMatrixID, decQuantity, Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(PRODUCT_INVENTORY_MOVEMENT.DEDUCT_SOLD_WHOLESALE), DateTime.Now, clsSODetails.SONo, clsSODetails.SellerName); /******************************************* * Update Selling Information * ****************************************/ int iBaseUnitID = clsProduct.get_BaseUnitID(lngProductID); if (iBaseUnitID != intProductUnitID) { clsProduct.UpdateSellingPrice(lngProductID, lngVariationMatrixID, clsSODetails.CustomerID, intProductUnitID, (decItemQuantity * decUnitCost) / decQuantity, -1, -1, -1,- 1, -1); // Price should be the sugegsted selling price } clsProduct.UpdateSellingWSPrice(lngProductID, lngVariationMatrixID, clsSODetails.CustomerID, intProductUnitID, decUnitCost); // WS Price should be the unit cost /******************************************* * Add to Inventory Analysis * ****************************************/ clsInventoryDetails = new InventoryDetails(); clsInventoryDetails.PostingDateFrom = clsERPConfigDetails.PostingDateFrom; clsInventoryDetails.PostingDateTo = clsERPConfigDetails.PostingDateTo; clsInventoryDetails.PostingDate = clsSODetails.DeliveryDate; clsInventoryDetails.ReferenceNo = clsSODetails.SONo; clsInventoryDetails.ContactID = clsSODetails.CustomerID; clsInventoryDetails.ContactCode = clsSODetails.CustomerCode; clsInventoryDetails.ProductID = lngProductID; clsInventoryDetails.ProductCode = strProductCode; clsInventoryDetails.VariationMatrixID = lngVariationMatrixID; clsInventoryDetails.MatrixDescription = strMatrixDescription; clsInventoryDetails.SoldQuantity = decQuantity; clsInventoryDetails.SoldCost = decItemCost - decVAT; clsInventoryDetails.SoldVAT = decItemCost; // Sales Cost with VAT clsInventory.Insert(clsInventoryDetails); } }
private void AddItemToInventory(long DebitMemoID) { POReturnDetails clsPOReturnDetails = Details(DebitMemoID); ERPConfig clsERPConfig = new ERPConfig(base.Connection, base.Transaction); ERPConfigDetails clsERPConfigDetails = clsERPConfig.Details(); POReturnItems clsPOReturnItems = new POReturnItems(base.Connection, base.Transaction); ProductUnit clsProductUnit = new ProductUnit(base.Connection, base.Transaction); Products clsProduct = new Products(base.Connection, base.Transaction); ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(base.Connection, base.Transaction); Inventory clsInventory = new Inventory(base.Connection, base.Transaction); //MySqlDataReader myReader = clsPOReturnItems.List(DebitMemoID, "DebitMemoItemID", SortOption.Ascending); System.Data.DataTable dt = clsPOReturnItems.ListAsDataTable(DebitMemoID); foreach (System.Data.DataRow dr in dt.Rows) { long lngProductID = Convert.ToInt64(dr["ProductID"]); // myReader.GetInt64("ProductID"); int intProductUnitID = Convert.ToInt16(dr["ProductUnitID"]); // myReader.GetInt16("ProductUnitID"); decimal decItemQuantity = Convert.ToDecimal(dr["Quantity"]); // myReader.GetDecimal("Quantity"); decimal decQuantity = clsProductUnit.GetBaseUnitValue(lngProductID, intProductUnitID, decItemQuantity); long lngVariationMatrixID = Convert.ToInt64(dr["VariationMatrixID"]); // myReader.GetInt64("VariationMatrixID"); string strMatrixDescription = dr["MatrixDescription"].ToString(); // "" + myReader["MatrixDescription"].ToString(); string strProductCode = dr["ProductCode"].ToString(); // "" + myReader["ProductCode"].ToString(); string strProductUnitCode = dr["ProductUnitCode"].ToString(); // "" + myReader["ProductUnitCode"].ToString(); decimal decUnitCost = Convert.ToDecimal(dr["UnitCost"]); // myReader.GetDecimal("UnitCost"); decimal decItemCost = Convert.ToDecimal(dr["Amount"]); // myReader.GetDecimal("Amount"); decimal decVAT = Convert.ToDecimal(dr["VAT"]); // myReader.GetDecimal("VAT"); /******************************************* * Subtract from Inventory * ****************************************/ // clsProduct.SubtractQuantity(ProductID, Quantity); // if (VariationMatrixID != 0) { clsProductVariationsMatrix.SubtractQuantity(VariationMatrixID, Quantity);} // July 26, 2011: change the above codes to the following clsProduct.SubtractQuantity(clsPOReturnDetails.BranchID, lngProductID, lngVariationMatrixID, decQuantity, Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(PRODUCT_INVENTORY_MOVEMENT.DEDUCT_PURCHASE_RETURN), DateTime.Now, clsPOReturnDetails.MemoNo, clsPOReturnDetails.PurchaserName); /******************************************* * Add to Inventory Analysis * ****************************************/ InventoryDetails clsInventoryDetails = new InventoryDetails(); clsInventoryDetails.PostingDateFrom = clsERPConfigDetails.PostingDateFrom; clsInventoryDetails.PostingDateTo = clsERPConfigDetails.PostingDateTo; clsInventoryDetails.PostingDate = clsPOReturnDetails.PostingDate; clsInventoryDetails.ReferenceNo = clsPOReturnDetails.MemoNo; clsInventoryDetails.ContactID = clsPOReturnDetails.SupplierID; clsInventoryDetails.ContactCode = clsPOReturnDetails.SupplierCode; clsInventoryDetails.ProductID = lngProductID; clsInventoryDetails.ProductCode = strProductCode; clsInventoryDetails.VariationMatrixID = lngVariationMatrixID; clsInventoryDetails.MatrixDescription = strMatrixDescription; clsInventoryDetails.PReturnQuantity = decQuantity; clsInventoryDetails.PReturnCost = decItemCost - decVAT; clsInventoryDetails.PReturnVAT = decItemCost; //Purchase Return with VAT clsInventory.Insert(clsInventoryDetails); } }
private void AddItemToInventory(long WBranchTransferID) { WBranchTransferDetails clsWBranchTransferDetails = Details(WBranchTransferID); ERPConfig clsERPConfig = new ERPConfig(base.Connection, base.Transaction); ERPConfigDetails clsERPConfigDetails = clsERPConfig.Details(); WBranchTransferItem clsWBranchTransferItem = new WBranchTransferItem(base.Connection, base.Transaction); ProductUnit clsProductUnit = new ProductUnit(base.Connection, base.Transaction); Products clsProduct = new Products(base.Connection, base.Transaction); Inventory clsInventory = new Inventory(base.Connection, base.Transaction); InventoryDetails clsInventoryDetails; System.Data.DataTable dt = clsWBranchTransferItem.ListAsDataTable(WBranchTransferID, "WBranchTransferItemID", SortOption.Ascending); foreach (System.Data.DataRow dr in dt.Rows) { long lngProductID = Int64.Parse(dr["ProductID"].ToString()); int intProductUnitID = Int16.Parse(dr["ProductUnitID"].ToString()); decimal decItemQuantity = decimal.Parse(dr["Quantity"].ToString()); decimal decQuantity = clsProductUnit.GetBaseUnitValue(lngProductID, intProductUnitID, decItemQuantity); long lngVariationMatrixID = Int64.Parse(dr["VariationMatrixID"].ToString()); string strMatrixDescription = "" + dr["MatrixDescription"].ToString(); string strProductCode = "" + dr["ProductCode"].ToString(); string strProductUnitCode = "" + dr["ProductUnitCode"].ToString(); decimal decUnitCost = decimal.Parse(dr["UnitCost"].ToString()); decimal decItemCost = decimal.Parse(dr["Amount"].ToString()); decimal decVAT = decimal.Parse(dr["VAT"].ToString()); /******************************************* * Subtract BranchIDFrom then Add to BranchIDTo -- Inventory * ****************************************/ clsProduct.SubtractQuantity(clsWBranchTransferDetails.BranchIDFrom, lngProductID, lngVariationMatrixID, decQuantity, Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(PRODUCT_INVENTORY_MOVEMENT.DEDUCT_BRANCH_TRANSFER_FROM) + " " + clsWBranchTransferDetails.BranchCodeFrom + " @ " + decUnitCost.ToString("#,##0.#0") + "/" + strProductUnitCode, DateTime.Now, clsWBranchTransferDetails.WBranchTransferNo, clsWBranchTransferDetails.TransferrerName); clsProduct.AddQuantity(clsWBranchTransferDetails.BranchIDTo, lngProductID, lngVariationMatrixID, decQuantity, Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(PRODUCT_INVENTORY_MOVEMENT.ADD_BRANCH_TRANSFER_TO) + " " + clsWBranchTransferDetails.BranchCodeTo + " @ " + decUnitCost.ToString("#,##0.#0") + "/" + strProductUnitCode, DateTime.Now, clsWBranchTransferDetails.WBranchTransferNo, clsWBranchTransferDetails.TransferrerName); /******************************************* * Add to Inventory Analysis * ****************************************/ clsInventoryDetails = new InventoryDetails(); clsInventoryDetails.PostingDateFrom = clsERPConfigDetails.PostingDateFrom; clsInventoryDetails.PostingDateTo = clsERPConfigDetails.PostingDateTo; clsInventoryDetails.PostingDate = clsWBranchTransferDetails.DeliveryDate; clsInventoryDetails.ReferenceNo = clsWBranchTransferDetails.WBranchTransferNo; clsInventoryDetails.ContactID = Constants.C_RETAILPLUS_SUPPLIERID; clsInventoryDetails.ContactCode = Constants.C_RETAILPLUS_SUPPLIER; clsInventoryDetails.ProductID = lngProductID; clsInventoryDetails.ProductCode = strProductCode; clsInventoryDetails.VariationMatrixID = lngVariationMatrixID; clsInventoryDetails.MatrixDescription = strMatrixDescription; clsInventoryDetails.PurchaseCost = decItemCost - decVAT; clsInventoryDetails.PurchaseVAT = decItemCost; // Purchase Cost with VAT // insert into branchid from with minus quantity clsInventoryDetails.BranchID = clsWBranchTransferDetails.BranchIDFrom; clsInventoryDetails.PurchaseQuantity = -decQuantity; clsInventory.Insert(clsInventoryDetails); // insert into branchid to with add quantity clsInventoryDetails.BranchID = clsWBranchTransferDetails.BranchIDTo; clsInventoryDetails.PurchaseQuantity = decQuantity; clsInventory.Insert(clsInventoryDetails); } }
/// <summary> /// Jul 28, 2011 : Lemu // - Remove the adding/subtracting and SynchronizeQuantity in clsProductVariationsMatrix, // already included in the new AddQuantity and SubtractQuantity. /// </summary> /// <param name="Details"></param> /// <param name="StockDirection"></param> /// <returns></returns> public Int64 AddItem(int BranchID, string TransactionNo, string CreatedBy, StockItemDetails Details, StockDirections StockDirection) { try { StockItem clsStockItem = new StockItem(base.Connection, base.Transaction); Int64 StockItemID = clsStockItem.Insert(Details); ProductUnit clsProductUnit = new ProductUnit(base.Connection, base.Transaction); decimal Quantity = clsProductUnit.GetBaseUnitValue(Details.ProductID, Details.ProductUnitID, Details.Quantity); string strRemarks = string.Empty; Products clsProduct = new Products(base.Connection, base.Transaction); if (StockDirection == StockDirections.Decrement) { strRemarks = Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(PRODUCT_INVENTORY_MOVEMENT.DEDUCT_STOCK_INVENTORY) + " " + Details.Remarks; clsProduct.SubtractQuantity(BranchID, Details.ProductID, Details.VariationMatrixID, Quantity, strRemarks, Details.StockDate, TransactionNo, CreatedBy); } else { strRemarks = Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(PRODUCT_INVENTORY_MOVEMENT.ADD_STOCK_INVENTORY) + " " + Details.Remarks; clsProduct.AddQuantity(BranchID, Details.ProductID, Details.VariationMatrixID, Quantity, strRemarks, Details.StockDate, TransactionNo, CreatedBy); } // Removed //ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(base.Connection, base.Transaction); //if (Details.VariationMatrixID != 0) //{ // if (StockDirection == StockDirections.Decrement) // { clsProductVariationsMatrix.SubtractQuantity(Details.VariationMatrixID, Quantity); } // else // { clsProductVariationsMatrix.AddQuantity(Details.VariationMatrixID, Quantity); } // clsProductVariationsMatrix.SynchronizeQuantity(Details.ProductID); //} return StockItemID; } catch (Exception ex) { throw base.ThrowException(ex); } }
private void SubtractItemFromInventory(long TransferOutID) { TransferOutDetails clsTransferOutDetails = Details(TransferOutID); ERPConfig clsERPConfig = new ERPConfig(base.Connection, base.Transaction); ERPConfigDetails clsERPConfigDetails = clsERPConfig.Details(); TransferOutItem clsTransferOutItem = new TransferOutItem(base.Connection, base.Transaction); ProductUnit clsProductUnit = new ProductUnit(base.Connection, base.Transaction); Products clsProduct = new Products(base.Connection, base.Transaction); ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(base.Connection, base.Transaction); ProductPackage clsProductPackage = new ProductPackage(base.Connection, base.Transaction); MatrixPackage clsMatrixPackage = new MatrixPackage(base.Connection, base.Transaction); Inventory clsInventory = new Inventory(base.Connection, base.Transaction); InventoryDetails clsInventoryDetails; //MatrixPackagePriceHistoryDetails clsMatrixPackagePriceHistoryDetails; //ProductPackagePriceHistoryDetails clsProductPackagePriceHistoryDetails; System.Data.DataTable dt = clsTransferOutItem.ListAsDataTable(TransferOutID, "TransferOutItemID", SortOption.Ascending); foreach (System.Data.DataRow dr in dt.Rows) { long lngProductID = long.Parse(dr["ProductID"].ToString()); int intProductUnitID = int.Parse(dr["ProductUnitID"].ToString()); decimal decItemQuantity = decimal.Parse(dr["Quantity"].ToString()); decimal decQuantity = clsProductUnit.GetBaseUnitValue(lngProductID, intProductUnitID, decItemQuantity); long lngVariationMatrixID = long.Parse(dr["VariationMatrixID"].ToString()); string strMatrixDescription = "" + dr["MatrixDescription"].ToString(); string strProductCode = "" + dr["ProductCode"].ToString(); decimal decUnitCost = decimal.Parse(dr["UnitCost"].ToString()); decimal decItemCost = decimal.Parse(dr["Amount"].ToString()); decimal decVAT = decimal.Parse(dr["VAT"].ToString()); ///******************************************* // * Add in the Purchase Price History // * ****************************************/ //if (lngVariationMatrixID != 0) //{ // // Update MatrixPackagePriceHistory first to get the history // clsMatrixPackagePriceHistoryDetails = new MatrixPackagePriceHistoryDetails(); // clsMatrixPackagePriceHistoryDetails.UID = clsTransferOutDetails.TransferrerID; // clsMatrixPackagePriceHistoryDetails.PackageID = clsMatrixPackage.GetPackageID(lngVariationMatrixID, intProductUnitID); // clsMatrixPackagePriceHistoryDetails.ChangeDate = DateTime.Now; // clsMatrixPackagePriceHistoryDetails.PurchasePrice = (decItemQuantity * decUnitCost) / decQuantity; // clsMatrixPackagePriceHistoryDetails.Price = -1; // clsMatrixPackagePriceHistoryDetails.VAT = -1; // clsMatrixPackagePriceHistoryDetails.EVAT = -1; // clsMatrixPackagePriceHistoryDetails.LocalTax = -1; // clsMatrixPackagePriceHistoryDetails.Remarks = "Based on TransferOut #: " + clsTransferOutDetails.TransferOutNo; // MatrixPackagePriceHistory clsMatrixPackagePriceHistory = new MatrixPackagePriceHistory(base.Connection, base.Transaction); // clsMatrixPackagePriceHistory.Insert(clsMatrixPackagePriceHistoryDetails); //} //else //{ // // Update ProductPackagePriceHistory first to get the history // clsProductPackagePriceHistoryDetails = new ProductPackagePriceHistoryDetails(); // clsProductPackagePriceHistoryDetails.UID = clsTransferOutDetails.TransferrerID; // clsProductPackagePriceHistoryDetails.PackageID = clsProductPackage.GetPackageID(lngProductID, intProductUnitID); // clsProductPackagePriceHistoryDetails.ChangeDate = DateTime.Now; // clsProductPackagePriceHistoryDetails.PurchasePrice = (decItemQuantity * decUnitCost) / decQuantity; // clsProductPackagePriceHistoryDetails.Price = -1; // clsProductPackagePriceHistoryDetails.VAT = -1; // clsProductPackagePriceHistoryDetails.EVAT = -1; // clsProductPackagePriceHistoryDetails.LocalTax = -1; // clsProductPackagePriceHistoryDetails.Remarks = "Based on TransferOut #: " + clsTransferOutDetails.TransferOutNo; // ProductPackagePriceHistory clsProductPackagePriceHistory = new ProductPackagePriceHistory(base.Connection, base.Transaction); // clsProductPackagePriceHistory.Insert(clsProductPackagePriceHistoryDetails); //} /******************************************* * Add to Inventory * ****************************************/ //clsProduct.AddQuantity(lngProductID, decQuantity); //if (lngVariationMatrixID != 0) //{ // clsProductVariationsMatrix.AddQuantity(lngVariationMatrixID, decQuantity); //} // July 26, 2011: change the above codes to the following clsProduct.SubtractQuantity(clsTransferOutDetails.BranchID, lngProductID, lngVariationMatrixID, decQuantity, Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(PRODUCT_INVENTORY_MOVEMENT.DEDUCT_TRANSFER_OUT), DateTime.Now, clsTransferOutDetails.TransferOutNo, clsTransferOutDetails.TransferrerName); ///******************************************* // * Update Purchasing Information // * ****************************************/ //clsProduct.UpdatePurchasing(lngProductID, clsTransferOutDetails.SupplierID, intProductUnitID, (decItemQuantity * decUnitCost) / decQuantity); //if (lngVariationMatrixID != 0) //{ // clsProductVariationsMatrix.UpdatePurchasing(lngVariationMatrixID, clsTransferOutDetails.SupplierID, intProductUnitID, (decItemQuantity * decUnitCost) / decQuantity); //} /******************************************* * Add to Inventory Analysis * ****************************************/ clsInventoryDetails = new InventoryDetails(); clsInventoryDetails.PostingDateFrom = clsERPConfigDetails.PostingDateFrom; clsInventoryDetails.PostingDateTo = clsERPConfigDetails.PostingDateTo; clsInventoryDetails.PostingDate = clsTransferOutDetails.DeliveryDate; clsInventoryDetails.ReferenceNo = clsTransferOutDetails.TransferOutNo; clsInventoryDetails.ContactID = clsTransferOutDetails.SupplierID; clsInventoryDetails.ContactCode = clsTransferOutDetails.SupplierCode; clsInventoryDetails.ProductID = lngProductID; clsInventoryDetails.ProductCode = strProductCode; clsInventoryDetails.VariationMatrixID = lngVariationMatrixID; clsInventoryDetails.MatrixDescription = strMatrixDescription; clsInventoryDetails.TransferOutQuantity = decQuantity; clsInventoryDetails.TransferOutCost = decItemCost - decVAT; clsInventoryDetails.TransferOutVAT = decItemCost; // TransferOut Cost with VAT clsInventory.Insert(clsInventoryDetails); /******************************************* * Added April 28, 2010 4:20PM * Update Selling Information when TransferOut is posted * ****************************************/ //clsProduct.UpdateSellingIncludingAllMatrixWithSameQuantityAndUnit(lngProductID, clsTransferOutDetails.SupplierID, intProductUnitID, decimal.Parse(myReader["SellingPrice"); //if (lngVariationMatrixID != 0) //{ // clsProductVariationsMatrix.UpdateSellingWithSameQuantityAndUnit(lngVariationMatrixID, clsPODetails.SupplierID, intProductUnitID, decimal.Parse(myReader["SellingPrice"); //} /******************************************* * Added April 28, 2010 4:20PM * Update the purchase price history to check who has the lowest price. * ****************************************/ //ProductPurchasePriceHistoryDetails clsProductPurchasePriceHistoryDetails = new ProductPurchasePriceHistoryDetails(); //clsProductPurchasePriceHistoryDetails.ProductID = lngProductID; //clsProductPurchasePriceHistoryDetails.MatrixID = lngVariationMatrixID; //clsProductPurchasePriceHistoryDetails.SupplierID = clsTransferOutDetails.SupplierID; //clsProductPurchasePriceHistoryDetails.PurchasePrice = decUnitCost; //clsProductPurchasePriceHistoryDetails.PurchaseDate = clsTransferOutDetails.TransferOutDate; //clsProductPurchasePriceHistoryDetails.Remarks = clsTransferOutDetails.TransferOutNo; //ProductPurchasePriceHistory clsProductPurchasePriceHistory = new ProductPurchasePriceHistory(base.Connection, base.Transaction); //clsProductPurchasePriceHistory.AddToList(clsProductPurchasePriceHistoryDetails); } }