public StoreOutStandingInventory IsHasRecordOnSOI(long CustNo, DateTime PeriodDate) { StoreOutStandingInventory SOI = new StoreOutStandingInventory(); try { SOI = GetBeginningOnSOI(CustNo, PeriodDate); } catch (Exception) { SOI = new StoreOutStandingInventory(); // ..throw; } return SOI; }
protected void btnSaveSOI_Click(object sender, EventArgs e) { Image image_outlet = new Image(); image_outlet = (Image)gvOutlets.SelectedRow.FindControl("imgOutlet"); StoreOutStandingInventory SOI_TO_SAVE = new StoreOutStandingInventory(); if (string.IsNullOrEmpty(txtActualAccountTotalCost.Text)) { txtActualAccountTotalCost.Text = "0.00"; } if (string.IsNullOrEmpty(txtActualAccountAvgCost.Text)) { txtActualAccountAvgCost.Text = "0.00"; } if (string.IsNullOrEmpty(txtActualAccountValue.Text)) { txtActualAccountValue.Text = "0.00"; } if (string.IsNullOrEmpty(txtActualAccountVolume.Text)) { txtActualAccountVolume.Text = "0"; } SOI_TO_SAVE.ActualCostTotalCost = decimal.Parse(txtActualAccountTotalCost.Text); SOI_TO_SAVE.ActualCountAverageCost = decimal.Parse(txtActualAccountAvgCost.Text); SOI_TO_SAVE.ActualCountValue = decimal.Parse(txtActualAccountValue.Text); SOI_TO_SAVE.ActualCountVolume = decimal.Parse(txtActualAccountVolume.Text); SOI_TO_SAVE.AdjustmentCreditAverageCost = decimal.Parse(txtCreditAvgCost.Text.Remove(0, 1).Replace(")", "")); SOI_TO_SAVE.AdjustmentCreditTotalCost = decimal.Parse(txtCreditTotalCost.Text.Remove(0, 1).Replace(")", "")); SOI_TO_SAVE.AdjustmentCreditValue = decimal.Parse(txtCreditValue.Text.Remove(0, 1).Replace(")", "")); SOI_TO_SAVE.AdjustmentCreditVolume = decimal.Parse(txtCreditVolume.Text.Remove(0, 1).Replace(")", "")); SOI_TO_SAVE.AdjustmentDebitAverageCost = decimal.Parse(txtDebitAvgCost.Text); SOI_TO_SAVE.AdjustmentDebitTotalCost = decimal.Parse(txtDebitTotalCost.Text); SOI_TO_SAVE.AdjustmentDebitValue = decimal.Parse(txtDebitValue.Text); SOI_TO_SAVE.AdjustmentDebitVolume = decimal.Parse(txtDebitVolume.Text); if (long.Parse(hfAdjustmentRecordNumber.Value) > 0) { SOI_TO_SAVE.AdjustmentRecordNumber = long.Parse(hfAdjustmentRecordNumber.Value); } else { SOI_TO_SAVE.AdjustmentRecordNumber = 0; } SOI_TO_SAVE.BeginningInventoryAverageCost = decimal.Parse(txtBeginningInventoryAvgCost.Text); SOI_TO_SAVE.BeginningInventoryTotalCost = decimal .Parse(txtBeginningInventoryTotalCost.Text); SOI_TO_SAVE.BeginningInventoryValue = decimal.Parse(txtBeginningInventoryValue.Text); SOI_TO_SAVE.BeginningInventoryVolume = decimal.Parse(txtBeginningInventoryVolume.Text); SOI_TO_SAVE.CustomerName = txtOutletName.Text ; SOI_TO_SAVE.CustomerNumber = int.Parse(image_outlet.AlternateText); SOI_TO_SAVE.Brand = gvOutlets.SelectedRow.Cells[4].Text; SOI_TO_SAVE.DateRecorded = DateTime.Now; SOI_TO_SAVE.DeliveryAverageCost = decimal.Parse(txtDeliveryAvgCost.Text); SOI_TO_SAVE.DeliveryTotalCost = decimal.Parse(txtdeliveryTotalCost.Text); SOI_TO_SAVE.DeliveryValue = decimal.Parse(txtDeliveryValue.Text); SOI_TO_SAVE.DeliveryVolume = decimal.Parse(txtDeliveryVolume.Text); if (txtDiscrepancyTotalCost.Text.StartsWith("(") == false) { SOI_TO_SAVE.DiscrepancyTotalCost = decimal.Parse(txtDiscrepancyTotalCost.Text); } else { SOI_TO_SAVE.DiscrepancyTotalCost = decimal.Parse(txtDiscrepancyTotalCost.Text.Remove(0, 1).Replace(")", "")); } if (txtDiscrepancyValue.Text.StartsWith("(") == false) { SOI_TO_SAVE.DiscrepancyValue = decimal.Parse(txtDiscrepancyValue.Text); } else { SOI_TO_SAVE.DiscrepancyValue = decimal.Parse(txtDiscrepancyValue.Text.Remove(0, 1).Replace(")", "")); } if (txtDiscrepancyVolume.Text.StartsWith("(") == false) { SOI_TO_SAVE.DiscrepancyVolume = decimal.Parse(txtDiscrepancyVolume.Text); } else { SOI_TO_SAVE.DiscrepancyVolume = decimal.Parse(txtDiscrepancyVolume.Text.Remove(0, 1).Replace(")", "")); } SOI_TO_SAVE.EndingInventoryAverageCost = decimal.Parse(txtEndingInvventoryAvgCost.Text); SOI_TO_SAVE.EndingInventoryTotalCost = decimal.Parse(txtEndingInvventoryTotalCost.Text); SOI_TO_SAVE.EndingInventoryValue = decimal.Parse(txtEndingInvventoryValue.Text); SOI_TO_SAVE.EndingInventoryVolume = decimal.Parse(txtEndingInvventoryVolume.Text); SOI_TO_SAVE.GrossSalesAverageCost = decimal.Parse(txtGrossSalesAvgCost.Text.Remove(0, 1).Replace(")", "")); SOI_TO_SAVE.GrossSalesTotalCost = decimal.Parse(txtGrossSalesTotalCost.Text.Remove(0, 1).Replace(")", "")); SOI_TO_SAVE.GrossSalesValue = decimal.Parse(txtGrossSalesValue.Text.Remove(0, 1).Replace(")", "")); SOI_TO_SAVE.GrossSalesVolume = decimal.Parse(txtGrossSalesVolume.Text.Remove(0, 1).Replace(")", "")); SOI_TO_SAVE.PeriodFrom = DateTime.Parse(txtPeriodFrom.Text); SOI_TO_SAVE.PeriodTo = DateTime.Parse(txtPeriodTo.Text); SOI_TO_SAVE.ReturnsAverageCost = decimal.Parse(txtPullOutAvgCost.Text.Remove(0,1).Replace(")","")); SOI_TO_SAVE.ReturnsTotalCost = decimal.Parse(txtPullOutTotalCost.Text.Remove(0, 1).Replace(")", "")); SOI_TO_SAVE.ReturnsValue = decimal.Parse(txtPullOutValue.Text.Remove(0, 1).Replace(")", "")); SOI_TO_SAVE.ReturnsVolume = decimal.Parse(txtPullOutVolume.Text.Remove(0, 1).Replace(")", "")); SOI_TO_SAVE.TransactionDate = DateTime.Parse(txtTransactionDate.Text); try { SOIManager.Save(SOI_TO_SAVE); #region log SOIManager.SaveTransactionLog(Permission.PERMITTED_USER, TransactionType.INSERT); #endregion } catch (Exception) { // throw; } }
public void GetSoiDetails(StoreOutStandingInventory SOI) { txtActualAccountAvgCost.Text = SOI.ActualCountAverageCost.ToString("###,###.00"); txtActualAccountTotalCost.Text = SOI.ActualCostTotalCost.ToString("###,###.00"); txtActualAccountValue.Text = SOI.ActualCountValue.ToString("###,###.00"); if (SOI.ActualCountVolume != 0) { txtActualAccountVolume.Text = SOI.ActualCountVolume.ToString("###,###"); } else { txtActualAccountVolume.Text = "(0)"; } txtBeginningInventoryAvgCost.Text = SOI.BeginningInventoryAverageCost.ToString("###,###.00"); txtBeginningInventoryTotalCost.Text = SOI.BeginningInventoryTotalCost.ToString("###,###.00"); txtBeginningInventoryValue.Text = SOI.BeginningInventoryValue.ToString("###,###.00"); if (SOI.BeginningInventoryVolume != 0) { txtBeginningInventoryVolume.Text = SOI.BeginningInventoryVolume.ToString("###,###"); } else { txtBeginningInventoryVolume.Text = "(0)"; } txtCreditAvgCost.Text = SOI.AdjustmentCreditAverageCost.ToString("(###,###.00)"); txtCreditTotalCost.Text = SOI.AdjustmentCreditTotalCost.ToString("(###,###.00)"); txtCreditValue.Text = SOI.AdjustmentCreditValue.ToString("(###,###.00)"); if (SOI.AdjustmentCreditVolume != 0) { txtCreditVolume.Text = SOI.AdjustmentCreditVolume.ToString("(###,###)"); } else { txtCreditVolume.Text = "(0)"; } txtDebitAvgCost.Text = SOI.AdjustmentDebitAverageCost.ToString("###,###.00"); txtDebitTotalCost.Text = SOI.AdjustmentDebitTotalCost.ToString("###,###.00"); txtDebitValue.Text = SOI.AdjustmentDebitValue.ToString("###,###.00"); if (SOI.AdjustmentDebitVolume != 0) { txtDebitVolume.Text = SOI.AdjustmentDebitVolume.ToString("###,###"); } else { txtDebitVolume.Text = "0"; } txtDeliveryAvgCost.Text = SOI.DeliveryAverageCost.ToString("###,###.00"); txtdeliveryTotalCost.Text = SOI.DeliveryTotalCost.ToString("###,###.00"); txtDeliveryValue.Text = SOI.DeliveryValue.ToString("###,###.00"); if (SOI.DeliveryVolume != 0) { txtDeliveryVolume.Text = SOI.DeliveryVolume.ToString("###,###"); } else { txtDeliveryVolume.Text = "(0)"; } if (SOI.DiscrepancyTotalCost <= 0) { txtDiscrepancyTotalCost.Text = (-1 * SOI.DiscrepancyTotalCost).ToString("(###,###.00)"); } else { txtDiscrepancyTotalCost.Text = (SOI.DiscrepancyTotalCost).ToString("###,###.00"); } if (SOI.DiscrepancyVolume <= 0) { txtDiscrepancyVolume.Text = (-1 * SOI.DiscrepancyVolume).ToString("(###,###)"); } else { txtDiscrepancyVolume.Text = (SOI.DiscrepancyVolume).ToString("(###,###)"); } if (SOI.DiscrepancyValue <= 0) { txtDiscrepancyValue.Text = (-1 * SOI.DiscrepancyValue).ToString("(###,###.00)"); } else { txtDiscrepancyValue.Text = (SOI.DiscrepancyValue).ToString("###,###.00"); } txtEndingInvventoryAvgCost.Text = SOI.EndingInventoryAverageCost.ToString("###,###.00"); txtEndingInvventoryTotalCost.Text = SOI.EndingInventoryTotalCost.ToString("###,###.00"); txtEndingInvventoryValue.Text = SOI.EndingInventoryValue.ToString("###,###.00"); if (SOI.EndingInventoryVolume != 0) { txtEndingInvventoryVolume.Text = SOI.EndingInventoryVolume.ToString("###,###"); } else { txtEndingInvventoryVolume.Text = "(0)"; } txtGrossSalesAvgCost.Text = SOI.GrossSalesAverageCost.ToString("(###,###.00)"); txtGrossSalesTotalCost.Text = SOI.GrossSalesTotalCost.ToString("(###,###.00)"); txtGrossSalesValue.Text = SOI.GrossSalesValue.ToString("(###,###.00)"); if (SOI.GrossSalesVolume != 0) { txtGrossSalesVolume.Text = SOI.GrossSalesVolume.ToString("(###,###)"); } else { txtGrossSalesVolume.Text = "(0)"; } txtOutletName.Text = SOI.CustomerName; txtPeriodFrom.Text = SOI.PeriodFrom.ToString("MMMM dd, yyyy"); txtPeriodTo.Text = SOI.PeriodTo.ToString("MMMM dd, yyyy"); txtPullOutAvgCost.Text = SOI.ReturnsAverageCost.ToString("(###,###.00)"); txtPullOutTotalCost.Text = SOI.ReturnsTotalCost.ToString("(###,###.00)"); txtPullOutValue.Text = SOI.ReturnsValue.ToString("(###,###.00)"); if (SOI.ReturnsVolume != 0) { txtPullOutVolume.Text = SOI.ReturnsVolume.ToString("(###,###)"); } else { txtPullOutVolume.Text = "(0)"; } txtTransactionDate.Text = SOI.TransactionDate.ToString("MMMM dd, yyyy"); lblCustomerNameToDelete.Text = "SOI FOR: " + SOI.CustomerName; lblDateFromToToDelete.Text = "PERIOD FROM: " + SOI.PeriodFrom.ToString("MMMM dd, yyyy") + " TO " + SOI.PeriodTo.ToString("MMMM dd, yyyy"); }