private void AddItemToInventory(long CreditMemoID) { CreditMemoDetails clsCreditMemoDetails = Details(CreditMemoID); ERPConfig clsERPConfig = new ERPConfig(base.Connection, base.Transaction); ERPConfigDetails clsERPConfigDetails = clsERPConfig.Details(); CreditMemoItems clsCreditMemoItems = new CreditMemoItems(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); System.Data.DataTable dt = clsCreditMemoItems.ListAsDataTable(CreditMemoID); 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()); /******************************************* * Do not Add to Inventory coz this is a Debit Memo and no effect on inventory * ****************************************/ /******************************************* * Add to Inventory Analysis * ****************************************/ InventoryDetails clsInventoryDetails = new InventoryDetails(); clsInventoryDetails.PostingDateFrom = clsERPConfigDetails.PostingDateFrom; clsInventoryDetails.PostingDateTo = clsERPConfigDetails.PostingDateTo; clsInventoryDetails.PostingDate = clsCreditMemoDetails.PostingDate; clsInventoryDetails.ReferenceNo = clsCreditMemoDetails.CNNo; clsInventoryDetails.ContactID = clsCreditMemoDetails.CustomerID; clsInventoryDetails.ContactCode = clsCreditMemoDetails.CustomerCode; clsInventoryDetails.ProductID = lngProductID; clsInventoryDetails.ProductCode = strProductCode; clsInventoryDetails.VariationMatrixID = lngVariationMatrixID; clsInventoryDetails.MatrixDescription = strMatrixDescription; clsInventoryDetails.SCreditQuantity = decQuantity; clsInventoryDetails.SCreditCost = decItemCost - decVAT; clsInventoryDetails.SCreditVAT = decItemCost; //Sales Return with VAT clsInventory.Insert(clsInventoryDetails); } //myReader.Close(); }
private void UpdateAccounts(long CreditMemoID) { try { CreditMemoDetails clsCreditMemoDetails = Details(CreditMemoID); ChartOfAccounts clsChartOfAccount = new ChartOfAccounts(base.Connection, base.Transaction); // update ChartOfAccountIDARTracking as credit clsChartOfAccount.UpdateCredit(clsCreditMemoDetails.ChartOfAccountIDARTracking, clsCreditMemoDetails.SubTotal); // update Deposit & APContra clsChartOfAccount.UpdateDebit(clsCreditMemoDetails.ChartOfAccountIDARContra, clsCreditMemoDetails.Discount); // update Freight & APTracking clsChartOfAccount.UpdateDebit(clsCreditMemoDetails.ChartOfAccountIDARTracking, clsCreditMemoDetails.Freight); clsChartOfAccount.UpdateCredit(clsCreditMemoDetails.ChartOfAccountIDARFreight, clsCreditMemoDetails.Freight); // update Deposit & APTracking clsChartOfAccount.UpdateDebit(clsCreditMemoDetails.ChartOfAccountIDARTracking, clsCreditMemoDetails.Deposit); clsChartOfAccount.UpdateCredit(clsCreditMemoDetails.ChartOfAccountIDARVDeposit, clsCreditMemoDetails.Deposit); CreditMemoItems clsCreditMemoItems = new CreditMemoItems(base.Connection, base.Transaction); System.Data.DataTable dt = clsCreditMemoItems.ListAsDataTable(CreditMemoID); foreach (System.Data.DataRow dr in dt.Rows) { int iChartOfAccountIDPurchase = Int16.Parse(dr["ChartOfAccountIDPurchase"].ToString()); int iChartOfAccountIDTaxPurchase = Int16.Parse(dr["ChartOfAccountIDTaxPurchase"].ToString()); decimal decVAT = decimal.Parse(dr["VAT"].ToString()); decimal decVATABLEAmount = decimal.Parse(dr["Amount"].ToString()) - decVAT; // update purchase as debit clsChartOfAccount.UpdateCredit(iChartOfAccountIDPurchase, decVATABLEAmount); // update tax as debit clsChartOfAccount.UpdateCredit(iChartOfAccountIDTaxPurchase, decVAT); } //myReader.Close(); } catch (Exception ex) { throw base.ThrowException(ex); } }
private void LoadItems() { CreditMemoItems clsCreditMemoItems = new CreditMemoItems(); lstItem.DataSource = clsCreditMemoItems.ListAsDataTable(Convert.ToInt64(lblCreditMemoID.Text)).DefaultView; lstItem.DataBind(); clsCreditMemoItems.CommitAndDispose(); }
private void SetDataSource(ReportDocument Report) { long iID = 0; try { if (Request.QueryString["task"].ToString().ToLower() == "reportfromposted" && Request.QueryString["retid"].ToString() != null) { iID = Convert.ToInt64(Request.QueryString["retid"].ToString()); } else { iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["retid"].ToString(), Session.SessionID)); } lblReferrer.ToolTip = iID.ToString(); } catch { iID = long.Parse(lblReferrer.ToolTip); } ReportDataset rptds = new ReportDataset(); CreditMemos clsCreditMemos = new CreditMemos(); MySqlDataReader myreader = clsCreditMemos.List(iID, "CreditMemoID", SortOption.Ascending); while (myreader.Read()) { DataRow drNew = rptds.CreditMemo.NewRow(); foreach (DataColumn dc in rptds.CreditMemo.Columns) drNew[dc] = "" + myreader[dc.ColumnName]; rptds.CreditMemo.Rows.Add(drNew); } myreader.Close(); CreditMemoItems clsCreditMemoItems = new CreditMemoItems(clsCreditMemos.Connection, clsCreditMemos.Transaction); System.Data.DataTable dt = clsCreditMemoItems.ListAsDataTable(iID); foreach(System.Data.DataRow dr in dt.Rows) { DataRow drNew = rptds.CreditMemoItem.NewRow(); foreach (DataColumn dc in rptds.CreditMemoItem.Columns) drNew[dc] = "" + dr[dc.ColumnName]; rptds.CreditMemoItem.Rows.Add(drNew); } clsCreditMemos.CommitAndDispose(); Report.SetDataSource(rptds); SetParameters(Report); }
private void AddItemToInventory(long CreditMemoID) { CreditMemoDetails clsCreditMemoDetails = Details(CreditMemoID); ERPConfig clsERPConfig = new ERPConfig(base.Connection, base.Transaction); ERPConfigDetails clsERPConfigDetails = clsERPConfig.Details(); CreditMemoItems clsCreditMemoItems = new CreditMemoItems(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); System.Data.DataTable dt = clsCreditMemoItems.ListAsDataTable(CreditMemoID); 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()); /******************************************* * Do not Add to Inventory coz this is a Debit Memo and no effect on inventory * ****************************************/ /******************************************* * Add to Inventory Analysis * ****************************************/ InventoryDetails clsInventoryDetails = new InventoryDetails(); clsInventoryDetails.PostingDateFrom = clsERPConfigDetails.PostingDateFrom; clsInventoryDetails.PostingDateTo = clsERPConfigDetails.PostingDateTo; clsInventoryDetails.PostingDate = clsCreditMemoDetails.PostingDate; clsInventoryDetails.ReferenceNo = clsCreditMemoDetails.CNNo; clsInventoryDetails.ContactID = clsCreditMemoDetails.CustomerID; clsInventoryDetails.ContactCode = clsCreditMemoDetails.CustomerCode; clsInventoryDetails.ProductID = lngProductID; clsInventoryDetails.ProductCode = strProductCode; clsInventoryDetails.VariationMatrixID = lngVariationMatrixID; clsInventoryDetails.MatrixDescription = strMatrixDescription; clsInventoryDetails.SCreditQuantity = decQuantity; clsInventoryDetails.SCreditCost = decItemCost - decVAT; clsInventoryDetails.SCreditVAT = decItemCost; //Sales Return with VAT clsInventory.Insert(clsInventoryDetails); } //myReader.Close(); }
private void UpdateAccounts(long CreditMemoID) { try { CreditMemoDetails clsCreditMemoDetails = Details(CreditMemoID); ChartOfAccounts clsChartOfAccount = new ChartOfAccounts(base.Connection, base.Transaction); // update ChartOfAccountIDARTracking as credit clsChartOfAccount.UpdateCredit(clsCreditMemoDetails.ChartOfAccountIDARTracking, clsCreditMemoDetails.SubTotal); // update Deposit & APContra clsChartOfAccount.UpdateDebit(clsCreditMemoDetails.ChartOfAccountIDARContra, clsCreditMemoDetails.Discount); // update Freight & APTracking clsChartOfAccount.UpdateDebit(clsCreditMemoDetails.ChartOfAccountIDARTracking, clsCreditMemoDetails.Freight); clsChartOfAccount.UpdateCredit(clsCreditMemoDetails.ChartOfAccountIDARFreight, clsCreditMemoDetails.Freight); // update Deposit & APTracking clsChartOfAccount.UpdateDebit(clsCreditMemoDetails.ChartOfAccountIDARTracking, clsCreditMemoDetails.Deposit); clsChartOfAccount.UpdateCredit(clsCreditMemoDetails.ChartOfAccountIDARVDeposit, clsCreditMemoDetails.Deposit); CreditMemoItems clsCreditMemoItems = new CreditMemoItems(base.Connection, base.Transaction); System.Data.DataTable dt = clsCreditMemoItems.ListAsDataTable(CreditMemoID); foreach (System.Data.DataRow dr in dt.Rows) { int iChartOfAccountIDPurchase = Int16.Parse(dr["ChartOfAccountIDPurchase"].ToString()); int iChartOfAccountIDTaxPurchase = Int16.Parse(dr["ChartOfAccountIDTaxPurchase"].ToString()); decimal decVAT = decimal.Parse(dr["VAT"].ToString()); decimal decVATABLEAmount = decimal.Parse(dr["Amount"].ToString()) - decVAT; // update purchase as debit clsChartOfAccount.UpdateCredit(iChartOfAccountIDPurchase, decVATABLEAmount); // update tax as debit clsChartOfAccount.UpdateCredit(iChartOfAccountIDTaxPurchase, decVAT); } //myReader.Close(); } catch (Exception ex) { throw base.ThrowException(ex); } }