protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { try { hfReportType.Value = PreviousPage.REPORT_MODE; ADJUSTMENT_ = PreviousPage.ADJUSTMENT; ADJUSTMENT_MEMO = PreviousPage.ADJUSTMENT_MEMO; hfAdjustmentRecordNo.Value = PreviousPage.ADJUSTMENT.RecordNo.ToString(); hfAdjustmentCode.Value = PreviousPage.ADJUSTMENT.AdjustmentCode; hfAdjustmentMemoRecordNo.Value = PreviousPage.ADJUSTMENT_MEMO.RecordNo.ToString(); } catch (Exception) { // throw; } } switch (hfReportType.Value) { case "ADJUSTMENT DETAILS": InitializeTransactionDetailsReportPreview(long.Parse(hfAdjustmentMemoRecordNo.Value)); break; case "ADJUSTMENT SUMMARY": InitializedReportPreview(hfAdjustmentCode.Value); break; case "ADJUSTMENT MEMO": InitializeAdjustmentMemoReportPreview(hfAdjustmentCode.Value, long .Parse(hfAdjustmentRecordNo.Value)); break; } }
protected void btnSaveMemo_Click(object sender, EventArgs e) { try { var Adjustment = new Adjustment { AdjustmentCode = CreateCode(15), InventoryDate = DateTime.Parse(txtInventoryDate.Text), CutOffDate = DateTime.Parse(txtCutOffDate.Text), ActualPhysicalCountQuantity = long.Parse(txtActualPhysicalCountQuantity.Text), ActualPhysicalCountCostPrice = decimal.Parse(txtActualPhysicalPriceCostPrice.Text), ActualPhysicalCountCurrentPrice = decimal.Parse(txtActualPhysicalCountCurrentPrice.Text), OutletName = hfOutletName.Value , OutletNumber = int.Parse(hfOutletNumber.Value), DateRecorded = DateTime.Now }; AdjustmentManager.Save(Adjustment); if (gvCreditParticulars.Rows.Count >0) { foreach (TableRow row in this.gvCreditParticulars.Rows) { var AdjustmentCreditMemo = new AdjustmentMemo { AdjustmentCode = Adjustment.AdjustmentCode, CostPrice = decimal.Parse(row.Cells[3].Text.Replace("Php", "")), CurrentPrice = decimal.Parse(row.Cells[2].Text.Replace("Php", "")), MemoDate = DateTime.Parse(txtDateCredit.Text), MemoType = "CREDIT", //OutLet = dlCreditOutlet.SelectedItem.Text, ParticularTransaction = row.Cells[0].Text, PeriodFrom = DateTime.Parse(txtDateCreditfrom.Text), PeriodTo = DateTime.Parse(txtDateCreditTo.Text), Quantity = long.Parse(row.Cells[1].Text), ReferenceNumber = long.Parse(txtCreditReferenceNumber.Text), DateRecorded = DateTime.Now }; AdjustmentMemoManager.Save(AdjustmentCreditMemo); } } if (this.gvParticulars.Rows.Count > 0) { foreach (TableRow row in this.gvParticulars.Rows) { var AdjustmentDebitMemo = new AdjustmentMemo { AdjustmentCode = Adjustment.AdjustmentCode, CostPrice = decimal.Parse(row.Cells[3].Text.Replace("Php", "")), CurrentPrice = decimal.Parse(row.Cells[2].Text.Replace("Php", "")), MemoDate = DateTime.Parse(txtDate.Text), MemoType = "DEBIT", //OutLet = dlOutlets.SelectedItem.Text, ParticularTransaction = row.Cells[0].Text, PeriodFrom = DateTime.Parse(txtDatePeriodFrom.Text), PeriodTo = DateTime.Parse(txtDatePeriodTo.Text), Quantity = long.Parse(row.Cells[1].Text), ReferenceNumber = long.Parse(txtReferenceNumber.Text), DateRecorded = DateTime.Now }; AdjustmentMemoManager.Save(AdjustmentDebitMemo); } } #region log AdjustmentManager.SaveTransactionLog(Permission.PERMITTED_USER, TransactionType.INSERT); #endregion lblSaved_ModalPopupExtender.Show(); } catch (Exception) { //throw; } }