/// <summary> /// Function to check the voucher type and fill the corresponding vouchertype in VoucherType combobox /// </summary> /// <param name="strVoucherType"></param> public void CallFromVoucherMenu(string strVoucherType) { try { if (formMDI.strVouchertype == "POS") { VoucherType = "POS"; } else VoucherType = strVoucherType; VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtblVouchetType = new DataTable(); dtblVouchetType = spVoucherType.VoucherTypeSelectionComboFill(strVoucherType); int inCount = dtblVouchetType.Rows.Count; cmbVoucherType.DataSource = dtblVouchetType; cmbVoucherType.ValueMember = "voucherTypeId"; cmbVoucherType.DisplayMember = "voucherTypeName"; cmbVoucherType.SelectedIndex = -1; if (inCount == 1) { cmbVoucherType.SelectedValue = dtblVouchetType.Rows[0].ItemArray[0].ToString(); btnGo_Click(btnGo, EventArgs.Empty); } else { base.Show(); } } catch (Exception ex) { MessageBox.Show("VTS1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill VoucherType combobox /// </summary> public void VoucherTypeComboFill() { try { VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtblVouchetType = new DataTable(); dtblVouchetType = spVoucherType.VoucherTypeSelectionComboFill("Contra Voucher"); DataRow dr = dtblVouchetType.NewRow(); dr[1] = "ALL"; dtblVouchetType.Rows.InsertAt(dr, 0); cmbVoucherType.DataSource = dtblVouchetType; cmbVoucherType.ValueMember = "voucherTypeId"; cmbVoucherType.DisplayMember = "voucherTypeName"; cmbVoucherType.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show("CRT:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill VoucherType combobox /// </summary> public void VoucherTypeNameComboFill() { try { DataTable dtblVoucherTyeName = new DataTable(); VoucherTypeSP spVoucherType = new VoucherTypeSP(); dtblVoucherTyeName = spVoucherType.VoucherTypeNameComboFill(); DataRow dr = dtblVoucherTyeName.NewRow(); dr[1] = "All"; dtblVoucherTyeName.Rows.InsertAt(dr, 0); cmbVoucherTypeName.DataSource = dtblVoucherTyeName; cmbVoucherTypeName.ValueMember = "voucherTypeId"; cmbVoucherTypeName.DisplayMember = "voucherTypeName"; } catch (Exception ex) { MessageBox.Show("MSR1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill VoucherType combobox /// </summary> public void VoucherTypeComboFill() { VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtbl = new DataTable(); try { dtbl = spVoucherType.VoucherTypeSelectionComboFill("Purchase Invoice"); DataRow drow = dtbl.NewRow(); drow["voucherTypeId"] = 0; drow["voucherTypeName"] = "All"; dtbl.Rows.InsertAt(drow, 0); cmbVoucherType.DataSource = dtbl; cmbVoucherType.ValueMember = "voucherTypeId"; cmbVoucherType.DisplayMember = "voucherTypeName"; } catch (Exception ex) { MessageBox.Show("PIREG2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// To fill the vouchertype combobox /// </summary> public void VoucherTypeComboFill(string strVoucherName) { try { DataTable dtbl = new DataTable(); VoucherTypeSP spVoucherType = new VoucherTypeSP(); dtbl = spVoucherType.VoucherTypeCombofillForTaxAndVat(strVoucherName); DataRow dr = dtbl.NewRow(); dr["voucherTypeName"] = "All"; dr["voucherTypeId"] = 0; dtbl.Rows.InsertAt(dr, 0); cmbVoucherType.DataSource = dtbl; cmbVoucherType.DisplayMember = "voucherTypeName"; cmbVoucherType.ValueMember = "voucherTypeId"; } catch (Exception ex) { MessageBox.Show("TR:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill VoucherType combobox /// </summary> public void VoucherTypeComboLoad() { try { VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtblVouchetType = new DataTable(); dtblVouchetType = spVoucherType.VoucherTypeSelectionComboFill("Journal Voucher"); DataRow dr = dtblVouchetType.NewRow(); dr[0] = 0; dr[1] = "ALL"; dtblVouchetType.Rows.InsertAt(dr, 0); cmbVoucherType.DataSource = dtblVouchetType; cmbVoucherType.ValueMember = "voucherTypeId"; cmbVoucherType.DisplayMember = "voucherTypeName"; cmbVoucherType.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show("JVREP2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill VoucherType combobox /// </summary> public void VoucherTypeComboFill() { try { VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtblVouchetType = new DataTable(); dtblVouchetType = spVoucherType.VoucherTypeSelectionComboFill("PDC Receivable"); DataRow dr = dtblVouchetType.NewRow(); dr[0] = 0; dr[1] = "All"; dtblVouchetType.Rows.InsertAt(dr, 0); cmbVouchertype.DataSource = dtblVouchetType; cmbVouchertype.ValueMember = "voucherTypeId"; cmbVouchertype.DisplayMember = "voucherTypeName"; cmbVouchertype.SelectedIndex = 0; } catch (Exception ex) { formMDI.infoError.ErrorString = "PRREP4:" + ex.Message; } }
/// <summary> /// Function to fill VoucherType combobox /// </summary> public void VoucherTypeComboFill() { VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtbl = new DataTable(); try { dtbl = spVoucherType.VoucherTypeSelectionComboFill("Purchase Invoice"); DataRow drow = dtbl.NewRow(); drow["voucherTypeId"] = 0; drow["voucherTypeName"] = "All"; dtbl.Rows.InsertAt(drow, 0); cmbVoucherType.DataSource = dtbl; cmbVoucherType.ValueMember = "voucherTypeId"; cmbVoucherType.DisplayMember = "voucherTypeName"; } catch (Exception ex) { formMDI.infoError.ErrorString = "PIREG2:" + ex.Message; } }
/// <summary> /// Function to fill vouchertype combobox /// </summary> public void voucherTypeComboFill() { try { VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtbl = new DataTable(); dtbl = spVoucherType.VoucherTypeViewAll(); DataRow dr = dtbl.NewRow(); dr[0] = 0; dr[1] = "All"; dtbl.Rows.InsertAt(dr, 0); cmbVoucherType.DataSource = dtbl; cmbVoucherType.DisplayMember = "voucherTypeName"; cmbVoucherType.ValueMember = "voucherTypeId"; cmbVoucherType.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show("DB1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill VoucherType Combobox /// </summary> public void VoucherTypeFill() { try { VoucherTypeSP spVoucher = new VoucherTypeSP(); DataTable dtblVoucher = new DataTable(); dtblVoucher = spVoucher.VoucherWiseProductSearchCombofill(); DataRow dr = dtblVoucher.NewRow(); dr["voucherTypeId"] = 0; dr["voucherTypeName"] = "All"; dtblVoucher.Rows.InsertAt(dr, 0); cmbVoucherType.DataSource = dtblVoucher; cmbVoucherType.ValueMember = "voucherTypeId"; cmbVoucherType.DisplayMember = "voucherTypeName"; } catch (Exception ex) { MessageBox.Show("VPS :02" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill VoucherType name combobox /// </summary> public void VoucherTypeNameComboFill() { try { VoucherTypeSP SpVoucherType = new VoucherTypeSP(); DataTable dtbl = new DataTable(); decimal decVoucherTypeId = 0; decVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()); dtbl = SpVoucherType.VoucherTypeNameViewAllForComboFill(decVoucherTypeId); DataRow dr = dtbl.NewRow(); dr[0] = 0; dr[1] = "All"; dtbl.Rows.InsertAt(dr, 0); cmbVoucherTypeName.DisplayMember = "voucherTypeName"; cmbVoucherTypeName.ValueMember = "voucherTypeId"; cmbVoucherTypeName.DataSource = dtbl; cmbVoucherTypeName.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show("AB2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill VoucherType name combobox /// </summary> public void VoucherTypeNameComboFill() { try { VoucherTypeSP SpVoucherType = new VoucherTypeSP(); DataTable dtbl = new DataTable(); decimal decVoucherTypeId = 0; decVoucherTypeId = Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()); dtbl = SpVoucherType.VoucherTypeNameViewAllForComboFill(decVoucherTypeId); DataRow dr = dtbl.NewRow(); dr[0] = 0; dr[1] = "All"; dtbl.Rows.InsertAt(dr, 0); cmbVoucherTypeName.DisplayMember = "voucherTypeName"; cmbVoucherTypeName.ValueMember = "voucherTypeId"; cmbVoucherTypeName.DataSource = dtbl; cmbVoucherTypeName.SelectedIndex = 0; } catch (Exception ex) { formMDI.infoError.ErrorString = "AB2:" + ex.Message; } }
/// <summary> /// Function to fill controls for updation /// </summary> public void fillFunction() { try { DailySalaryVoucherMasterSP SpMaster = new DailySalaryVoucherMasterSP(); DailySalaryVoucherMasterInfo InfoMaster = new DailySalaryVoucherMasterInfo(); VoucherTypeSP spVoucherType = new VoucherTypeSP(); InfoMaster = SpMaster.DailySalaryVoucherViewFromRegister(decMasterIdforEdit); strVoucherNoforEdit = InfoMaster.VoucherNo; strVoucherNo = InfoMaster.VoucherNo; txtVoucherNo.Text = InfoMaster.InvoiceNo; strInvoiceNo = InfoMaster.InvoiceNo; dtpDate.Text = InfoMaster.Date.ToString(); dtpSalaryDate.Text = InfoMaster.SalaryDate.ToString(); lblShowTotelamount.Text = Math.Round(Convert.ToDecimal(InfoMaster.TotalAmount.ToString("0.00000")), PublicVariables._inNoOfDecimalPlaces).ToString(); txtNarration.Text = InfoMaster.Narration; decDailySuffixPrefixId = InfoMaster.SuffixPrefixId; decDailyVoucherTypeId = InfoMaster.VoucherTypeId; cmbCashorBankAccount.SelectedValue = InfoMaster.LedgerId.ToString(); isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decDailyVoucherTypeId); if (isAutomatic) { txtVoucherNo.Enabled = false; } else { txtVoucherNo.Enabled = true; } dtpSalaryDate.Enabled = false; txtSalaryDate.Enabled = false; DailySalaryVoucherDetailsGridfill(isEditmode); } catch (Exception ex) { MessageBox.Show("DSV6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call this form from VoucherType Selection form /// </summary> /// <param name="decPaymentVoucherTypeId1"></param> /// <param name="strVoucherTypeNames1"></param> public void CallFromVoucherTypeSelection(decimal decPaymentVoucherTypeId1, string strVoucherTypeNames1) { try { decPaymentVoucherTypeId = decPaymentVoucherTypeId1; VoucherTypeSP spVoucherType = new VoucherTypeSP(); isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decPaymentVoucherTypeId); SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(decPaymentVoucherTypeId, dtpDate.Value); decDailySuffixPrefixId = infoSuffixPrefix.SuffixprefixId; strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; base.Show(); Clear(); } catch (Exception ex) { MessageBox.Show("PV13:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill TypeOfVoucher combobox /// </summary> public void TypeOfVoucherCombofill() { try { DataTable dtbl = new DataTable(); VoucherTypeSP spVoucherType = new VoucherTypeSP(); dtbl = spVoucherType.TypeOfVoucherCombofillForVatAndTaxReport(); DataRow dr = dtbl.NewRow(); dr["typeOfVoucher"] = "All"; dr["voucherTypeId"] = 0; dtbl.Rows.InsertAt(dr, 0); cmbTypeOfVoucher.DataSource = dtbl; cmbTypeOfVoucher.DisplayMember = "typeOfVoucher"; cmbTypeOfVoucher.ValueMember = "voucherTypeId"; } catch (Exception ex) { MessageBox.Show("TR:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Grid Fill function while coming from other form to update or delete /// </summary> public void FillFunction() { try { PaymentMasterSP SpPaymentMaster = new PaymentMasterSP(); PaymentMasterInfo InfoPaymentMaster = new PaymentMasterInfo(); PaymentDetailsSP SpPaymentDetails = new PaymentDetailsSP(); PartyBalanceSP SpPartyBalance = new PartyBalanceSP(); LedgerPostingSP SpLedgerPosting = new LedgerPostingSP(); VoucherTypeSP SpVoucherType = new VoucherTypeSP(); AccountGroupSP spAccountGroup = new AccountGroupSP(); AccountLedgerSP SpAccountLedger = new AccountLedgerSP(); InfoPaymentMaster = SpPaymentMaster.PaymentMasterViewByMasterId(decPaymentmasterId);//view master details isAutomatic = SpVoucherType.CheckMethodOfVoucherNumbering(InfoPaymentMaster.VoucherTypeId); if (isAutomatic) { txtVoucherNo.ReadOnly = true; txtVoucherNo.Text = InfoPaymentMaster.InvoiceNo; txtDate.Focus(); } else { txtVoucherNo.ReadOnly = false; txtVoucherNo.Text = InfoPaymentMaster.InvoiceNo; txtVoucherNo.Focus(); } dtpDate.Text = InfoPaymentMaster.Date.ToString(); cmbBankorCash.SelectedValue = InfoPaymentMaster.LedgerId; txtNarration.Text = InfoPaymentMaster.Narration; txtTotal.Text = InfoPaymentMaster.TotalAmount.ToString(); decDailySuffixPrefixId = InfoPaymentMaster.SuffixPrefixId; decPaymentVoucherTypeId = InfoPaymentMaster.VoucherTypeId; strVoucherNo = InfoPaymentMaster.VoucherNo; strInvoiceNo = InfoPaymentMaster.InvoiceNo; DataTable dtbl = new DataTable(); dtbl = SpPaymentDetails.PaymentDetailsViewByMasterId(decPaymentmasterId);//view details details for (int inI = 0; inI < dtbl.Rows.Count; inI++) { dgvPaymentVoucher.Rows.Add(); dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value = Convert.ToDecimal(dtbl.Rows[inI]["ledgerId"].ToString()); dgvPaymentVoucher.Rows[inI].Cells["dgvtxtpaymentMasterId"].Value = dtbl.Rows[inI]["paymentMasterId"].ToString(); dgvPaymentVoucher.Rows[inI].Cells["dgvtxtpaymentDetailsId"].Value = dtbl.Rows[inI]["paymentDetailsId"].ToString(); dgvPaymentVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = dtbl.Rows[inI]["amount"].ToString(); dgvPaymentVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(dtbl.Rows[inI]["exchangeRateId"].ToString()); decimal decDetailsId1 = Convert.ToDecimal(dtbl.Rows[inI]["paymentDetailsId"].ToString()); decimal decLedgerPostingId = SpLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, decPaymentVoucherTypeId); dgvPaymentVoucher.Rows[inI].Cells["dgvtxtLedgerPostingId"].Value = decLedgerPostingId.ToString(); decimal decLedgerId = Convert.ToDecimal(dtbl.Rows[inI]["ledgerId"].ToString()); bool IsBankAccount = spAccountGroup.AccountGroupwithLedgerId(decLedgerId); decimal decI = Convert.ToDecimal(SpAccountLedger.AccountGroupIdCheck(dgvPaymentVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].FormattedValue.ToString())); if (decI > 0)//to make amount and currency read only when party is choosen as ledger { dgvPaymentVoucher.Rows[inI].Cells["dgvtxtAmount"].ReadOnly = true; dgvPaymentVoucher.Rows[inI].Cells["dgvcmbCurrency"].ReadOnly = true; } else { dgvPaymentVoucher.Rows[inI].Cells["dgvtxtAmount"].ReadOnly = false; dgvPaymentVoucher.Rows[inI].Cells["dgvcmbCurrency"].ReadOnly = false; } dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value = dtbl.Rows[inI]["ChequeNo"].ToString(); if (dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value != null && dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value.ToString() != string.Empty) { dgvPaymentVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value = Convert.ToDateTime(dtbl.Rows[inI]["ChequeDate"].ToString()).ToString("dd-MMM-yyyy"); } } DataTable dtbl1 = new DataTable(); dtbl1 = SpPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decPaymentVoucherTypeId, strVoucherNo, InfoPaymentMaster.Date); dtblPartyBalance = dtbl1; } catch (Exception ex) { MessageBox.Show("PV36:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Dotmatrix print function add the details to fill here /// </summary> /// <param name="decPaymentMasterId"></param> public void PrintForDotMatrix(decimal decPaymentMasterId) { try { DataTable dtblOtherDetails = new DataTable(); CompanySP spComapany = new CompanySP(); dtblOtherDetails = spComapany.CompanyViewForDotMatrix(); DataTable dtblGridDetails = new DataTable(); dtblGridDetails.Columns.Add("SlNo"); dtblGridDetails.Columns.Add("Account Ledger"); dtblGridDetails.Columns.Add("Amount"); dtblGridDetails.Columns.Add("Currency"); dtblGridDetails.Columns.Add("Cheque No"); dtblGridDetails.Columns.Add("Cheque Date"); int inRowCount = 0; foreach (DataGridViewRow dRow in dgvPaymentVoucher.Rows) { if (dRow.HeaderCell.Value != null && dRow.HeaderCell.Value.ToString() != "X") { if (!dRow.IsNewRow) { DataRow dr = dtblGridDetails.NewRow(); dr["SlNo"] = ++inRowCount; dr["Account Ledger"] = dRow.Cells["dgvcmbAccountLedger"].FormattedValue.ToString(); dr["Amount"] = dRow.Cells["dgvtxtAmount"].Value.ToString(); dr["Currency"] = dRow.Cells["dgvcmbCurrency"].FormattedValue.ToString(); dr["Cheque No"] = (dRow.Cells["dgvtxtChequeNo"].Value == null ? "" : dRow.Cells["dgvtxtChequeNo"].Value.ToString()); dr["Cheque Date"] = (dRow.Cells["dgvtxtChequeDate"].Value == null ? "" : dRow.Cells["dgvtxtChequeDate"].Value.ToString()); dtblGridDetails.Rows.Add(dr); } } } dtblOtherDetails.Columns.Add("voucherNo"); dtblOtherDetails.Columns.Add("date"); dtblOtherDetails.Columns.Add("totalAmount"); dtblOtherDetails.Columns.Add("ledgerName"); dtblOtherDetails.Columns.Add("Narration"); dtblOtherDetails.Columns.Add("AmountInWords"); dtblOtherDetails.Columns.Add("Declaration"); dtblOtherDetails.Columns.Add("Heading1"); dtblOtherDetails.Columns.Add("Heading2"); dtblOtherDetails.Columns.Add("Heading3"); dtblOtherDetails.Columns.Add("Heading4"); DataRow dRowOther = dtblOtherDetails.Rows[0]; dRowOther["voucherNo"] = txtVoucherNo.Text; dRowOther["date"] = txtDate.Text; dRowOther["totalAmount"] = txtTotal.Text; dRowOther["ledgerName"] = cmbBankorCash.Text; dRowOther["Narration"] = txtNarration.Text; dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtTotal.Text), PublicVariables._decCurrencyId); dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", ""); VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtblDeclaration = spVoucherType.DeclarationAndHeadingGetByVoucherTypeId(decPaymentVoucherTypeId); dRowOther["Declaration"] = dtblDeclaration.Rows[0]["Declaration"].ToString(); dRowOther["Heading1"] = dtblDeclaration.Rows[0]["Heading1"].ToString(); dRowOther["Heading2"] = dtblDeclaration.Rows[0]["Heading2"].ToString(); dRowOther["Heading3"] = dtblDeclaration.Rows[0]["Heading3"].ToString(); dRowOther["Heading4"] = dtblDeclaration.Rows[0]["Heading4"].ToString(); int inFormId = spVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString())); PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails); } catch (Exception ex) { MessageBox.Show("PV:11" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the fields for edit or delete /// </summary> public void FillFunction() { try { JournalMasterInfo infoJournalMaster = new JournalMasterInfo(); JournalMasterSP spJournalMaster = new JournalMasterSP(); infoJournalMaster = spJournalMaster.JournalMasterView(decJournalMasterIdForEdit); VoucherTypeInfo infoVoucherType = new VoucherTypeInfo(); VoucherTypeSP spVoucherType = new VoucherTypeSP(); infoVoucherType = spVoucherType.VoucherTypeView(infoJournalMaster.VoucherTypeId); this.Text = infoVoucherType.VoucherTypeName; txtVoucherNo.ReadOnly = false; strVoucherNo = infoJournalMaster.VoucherNo; strInvoiceNo = infoJournalMaster.InvoiceNo; txtVoucherNo.Text = strInvoiceNo; decJournalSuffixPrefixId = infoJournalMaster.SuffixPrefixId; decJournalVoucherTypeId = infoJournalMaster.VoucherTypeId; dtpVoucherDate.Value = infoJournalMaster.Date; txtNarration.Text = infoJournalMaster.Narration; isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decJournalVoucherTypeId); if (isAutomatic) { txtVoucherNo.ReadOnly = true; } else { txtVoucherNo.ReadOnly = false; } //GridFill DataTable dtbl = new DataTable(); JournalDetailsSP spJournalDetailsSp = new JournalDetailsSP(); dtbl = spJournalDetailsSp.JournalDetailsViewByMasterId(decJournalMasterIdForEdit); AccountLedgerSP spAccountLedger = new AccountLedgerSP(); LedgerPostingSP spLedgerPosting = new LedgerPostingSP(); for (int inI = 0; inI < dtbl.Rows.Count; inI++) { dgvJournalVoucher.Rows.Add(); dgvJournalVoucher.Rows[inI].Cells["dgvcmbAccountLedger"].Value = Convert.ToDecimal(dtbl.Rows[inI]["ledgerId"].ToString()); if (Convert.ToDecimal(dtbl.Rows[inI]["debit"].ToString()) == 0) { dgvJournalVoucher.Rows[inI].Cells["dgvcmbDrOrCr"].Value = "Cr"; dgvJournalVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = Convert.ToDecimal(dtbl.Rows[inI]["credit"].ToString()); } else { dgvJournalVoucher.Rows[inI].Cells["dgvcmbDrOrCr"].Value = "Dr"; dgvJournalVoucher.Rows[inI].Cells["dgvtxtAmount"].Value = Convert.ToDecimal(dtbl.Rows[inI]["debit"].ToString()); } dgvJournalVoucher.Rows[inI].Cells["dgvcmbCurrency"].Value = Convert.ToDecimal(dtbl.Rows[inI]["exchangeRateId"].ToString()); if (dtbl.Rows[inI]["chequeNo"].ToString() != string.Empty) { dgvJournalVoucher.Rows[inI].Cells["dgvtxtChequeNo"].Value = dtbl.Rows[inI]["chequeNo"].ToString(); dgvJournalVoucher.Rows[inI].Cells["dgvtxtChequeDate"].Value = (Convert.ToDateTime(dtbl.Rows[inI]["chequeDate"].ToString())).ToString("dd-MMM-yyyy"); } dgvJournalVoucher.Rows[inI].Cells["dgvtxtDetailsId"].Value = dtbl.Rows[inI]["journalDetailsId"].ToString(); decimal decDetailsId1 = Convert.ToDecimal(dtbl.Rows[inI]["journalDetailsId"].ToString()); decimal decLedgerPostingId = spLedgerPosting.LedgerPostingIdFromDetailsId(decDetailsId1, strVoucherNo, decJournalVoucherTypeId); dgvJournalVoucher.Rows[inI].Cells["dgvtxtLedgerPostingId"].Value = decLedgerPostingId.ToString(); btnSave.Text = "Update"; } PartyBalanceSP SpPartyBalance = new PartyBalanceSP(); DataTable dtbl1 = new DataTable(); dtbl1 = SpPartyBalance.PartyBalanceViewByVoucherNoAndVoucherType(decJournalVoucherTypeId, strVoucherNo, infoJournalMaster.Date); dtblPartyBalance = dtbl1; dgvJournalVoucher.ClearSelection(); txtDate.Focus(); } catch (Exception ex) { MessageBox.Show("JV37:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// It is a function for vouchertypeselection form to select perticular voucher and open the form under the vouchertype /// </summary> /// <param name="decVoucherTypeId"></param> /// <param name="strVoucherTypeName"></param> public void CallFromVoucherTypeSelection(decimal decVoucherTypeId, string strVoucherTypeName) { try { decJournalVoucherTypeId = decVoucherTypeId; VoucherTypeSP spVoucherType = new VoucherTypeSP(); isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decJournalVoucherTypeId); SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(decJournalVoucherTypeId, dtpVoucherDate.Value); decJournalSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; this.Text = strVoucherTypeName; base.Show(); clear(); } catch (Exception ex) { MessageBox.Show("JV1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Print function for dotmatrix printer /// </summary> /// <param name="decSalesMasterId"></param> public void PrintForDotMatrix(decimal decSalesMasterId) { try { DataTable dtblOtherDetails = new DataTable(); CompanySP spComapany = new CompanySP(); dtblOtherDetails = spComapany.CompanyViewForDotMatrix(); DataTable dtblGridDetails = new DataTable(); dtblGridDetails.Columns.Add("SlNo"); dtblGridDetails.Columns.Add("BarCode"); dtblGridDetails.Columns.Add("ProductCode"); dtblGridDetails.Columns.Add("ProductName"); dtblGridDetails.Columns.Add("Qty"); dtblGridDetails.Columns.Add("Unit"); dtblGridDetails.Columns.Add("Godown"); dtblGridDetails.Columns.Add("Brand"); dtblGridDetails.Columns.Add("Tax"); dtblGridDetails.Columns.Add("TaxAmount"); dtblGridDetails.Columns.Add("NetAmount"); dtblGridDetails.Columns.Add("DiscountAmount"); dtblGridDetails.Columns.Add("DiscountPercentage"); dtblGridDetails.Columns.Add("SalesRate"); dtblGridDetails.Columns.Add("PurchaseRate"); dtblGridDetails.Columns.Add("MRP"); dtblGridDetails.Columns.Add("Rack"); dtblGridDetails.Columns.Add("Batch"); dtblGridDetails.Columns.Add("Rate"); dtblGridDetails.Columns.Add("Amount"); int inRowCount = 0; foreach (DataGridViewRow dRow in dgvSalesInvoice.Rows) { if (!dRow.IsNewRow) { DataRow dr = dtblGridDetails.NewRow(); dr["SlNo"] = ++inRowCount; if (dRow.Cells["dgvtxtSalesInvoiceBarcode"].Value != null) { dr["BarCode"] = dRow.Cells["dgvtxtSalesInvoiceBarcode"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceProductCode"].Value != null) { dr["ProductCode"] = dRow.Cells["dgvtxtSalesInvoiceProductCode"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceProductName"].Value != null) { dr["ProductName"] = dRow.Cells["dgvtxtSalesInvoiceProductName"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceQty"].Value != null) { dr["Qty"] = dRow.Cells["dgvtxtSalesInvoiceQty"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoicembUnitName"].Value != null) { dr["Unit"] = dRow.Cells["dgvtxtSalesInvoicembUnitName"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbSalesInvoiceGodown"].Value != null) { dr["Godown"] = dRow.Cells["dgvcmbSalesInvoiceGodown"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbSalesInvoiceRack"].Value != null) { dr["Rack"] = dRow.Cells["dgvcmbSalesInvoiceRack"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbSalesInvoiceBatch"].Value != null) { dr["Batch"] = dRow.Cells["dgvcmbSalesInvoiceBatch"].FormattedValue.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceRate"].Value != null) { dr["Rate"] = dRow.Cells["dgvtxtSalesInvoiceRate"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceAmount"].Value != null) { dr["Amount"] = dRow.Cells["dgvtxtSalesInvoiceAmount"].Value.ToString(); } if (dRow.Cells["dgvcmbSalesInvoiceTaxName"].Value != null) { dr["Tax"] = dRow.Cells["dgvcmbSalesInvoiceTaxName"].FormattedValue.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceBrand"].Value != null) { dr["Brand"] = dRow.Cells["dgvtxtSalesInvoiceBrand"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceTaxAmount"].Value != null) { dr["TaxAmount"] = dRow.Cells["dgvtxtSalesInvoiceTaxAmount"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceNetAmount"].Value != null) { dr["NetAmount"] = dRow.Cells["dgvtxtSalesInvoiceNetAmount"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceDiscountAmount"].Value != null) { dr["DiscountAmount"] = dRow.Cells["dgvtxtSalesInvoiceDiscountAmount"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceDiscountPercentage"].Value != null) { dr["DiscountPercentage"] = dRow.Cells["dgvtxtSalesInvoiceDiscountPercentage"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceSalesRate"].Value != null) { dr["SalesRate"] = dRow.Cells["dgvtxtSalesInvoiceSalesRate"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoicePurchaseRate"].Value != null) { dr["PurchaseRate"] = dRow.Cells["dgvtxtSalesInvoicePurchaseRate"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceMrp"].Value != null) { dr["MRP"] = dRow.Cells["dgvtxtSalesInvoiceMrp"].Value.ToString(); } dtblGridDetails.Rows.Add(dr); } } dtblOtherDetails.Columns.Add("voucherNo"); dtblOtherDetails.Columns.Add("date"); dtblOtherDetails.Columns.Add("ledgerName"); dtblOtherDetails.Columns.Add("SalesMode"); dtblOtherDetails.Columns.Add("SalesAccount"); dtblOtherDetails.Columns.Add("SalesMan"); dtblOtherDetails.Columns.Add("CreditPeriod"); dtblOtherDetails.Columns.Add("VoucherType"); dtblOtherDetails.Columns.Add("PricingLevel"); dtblOtherDetails.Columns.Add("Customer"); dtblOtherDetails.Columns.Add("CustomerAddress"); dtblOtherDetails.Columns.Add("CustomerTIN"); dtblOtherDetails.Columns.Add("CustomerCST"); dtblOtherDetails.Columns.Add("Narration"); dtblOtherDetails.Columns.Add("Currency"); dtblOtherDetails.Columns.Add("TotalAmount"); dtblOtherDetails.Columns.Add("BillDiscount"); dtblOtherDetails.Columns.Add("GrandTotal"); dtblOtherDetails.Columns.Add("AmountInWords"); dtblOtherDetails.Columns.Add("Declaration"); dtblOtherDetails.Columns.Add("Heading1"); dtblOtherDetails.Columns.Add("Heading2"); dtblOtherDetails.Columns.Add("Heading3"); dtblOtherDetails.Columns.Add("Heading4"); DataRow dRowOther = dtblOtherDetails.Rows[0]; dRowOther["voucherNo"] = txtInvoiceNo.Text; dRowOther["date"] = txtDate.Text; dRowOther["ledgerName"] = cmbCashOrParty.Text; dRowOther["Narration"] = txtNarration.Text; dRowOther["Currency"] = cmbCurrency.Text; dRowOther["SalesMode"] = cmbSalesMode.Text; dRowOther["SalesAccount"] = cmbSalesAccount.Text; dRowOther["SalesMan"] = cmbSalesMan.SelectedText; dRowOther["CreditPeriod"] = (txtCreditPeriod.Text) + " Days"; dRowOther["PricingLevel"] = cmbPricingLevel.Text; dRowOther["Customer"] = txtCustomer.Text; dRowOther["BillDiscount"] = txtBillDiscount.Text; dRowOther["GrandTotal"] = txtGrandTotal.Text; dRowOther["TotalAmount"] = txtTotalAmount.Text; dRowOther["VoucherType"] = cmbVoucherType.Text; dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", ""); AccountLedgerSP spAccountLedger = new AccountLedgerSP(); AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo(); infoAccountLedger = spAccountLedger.AccountLedgerView(Convert.ToDecimal(cmbCashOrParty.SelectedValue)); dRowOther["CustomerAddress"] = (infoAccountLedger.Address.ToString().Replace("\n", ", ")).Replace("\r", ""); dRowOther["CustomerTIN"] = infoAccountLedger.Tin; dRowOther["CustomerCST"] = infoAccountLedger.Cst; dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtGrandTotal.Text), PublicVariables._decCurrencyId); VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtblDeclaration = spVoucherType.DeclarationAndHeadingGetByVoucherTypeId(DecSalesInvoiceVoucherTypeId); dRowOther["Declaration"] = dtblDeclaration.Rows[0]["Declaration"].ToString(); dRowOther["Heading1"] = dtblDeclaration.Rows[0]["Heading1"].ToString(); dRowOther["Heading2"] = dtblDeclaration.Rows[0]["Heading2"].ToString(); dRowOther["Heading3"] = dtblDeclaration.Rows[0]["Heading3"].ToString(); dRowOther["Heading4"] = dtblDeclaration.Rows[0]["Heading4"].ToString(); int inFormId = spVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString())); PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails); } catch (Exception ex) { MessageBox.Show("SI: 74" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Fill function from coming from register or report or other forms /// </summary> public void FillRegisterOrReport() { SalesMasterSP spSalesMaster = new SalesMasterSP(); SalesDetailsSP spSalesDetails = new SalesDetailsSP(); VoucherTypeSP spVoucherType = new VoucherTypeSP(); SalesBillTaxSP spSalesBillTax = new SalesBillTaxSP(); try { isFromEditMode = true; btnSave.Text = "Update"; btnDelete.Enabled = true; txtInvoiceNo.ReadOnly = true; DataTable dtblMaster = spSalesMaster.SalesInvoiceSalesMasterViewBySalesMasterId(decSalesInvoiceIdToEdit); DecSalesInvoiceVoucherTypeId = Convert.ToDecimal(dtblMaster.Rows[0]["voucherTypeId"].ToString()); VoucherTypeInfo infoVoucherType = new VoucherTypeInfo(); infoVoucherType = spVoucherType.VoucherTypeView(DecSalesInvoiceVoucherTypeId); this.Text = infoVoucherType.VoucherTypeName; txtDate.Text = dtblMaster.Rows[0]["date"].ToString(); dtpDate.Value = DateTime.Parse(txtDate.Text); CurrencyComboFill(); txtInvoiceNo.Text = dtblMaster.Rows[0]["invoiceNo"].ToString(); txtCreditPeriod.Text = dtblMaster.Rows[0]["creditPeriod"].ToString(); strVoucherNo = dtblMaster.Rows[0]["voucherNo"].ToString(); decSalseInvoiceSuffixPrefixId = Convert.ToDecimal(dtblMaster.Rows[0]["suffixPrefixId"].ToString()); isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(DecSalesInvoiceVoucherTypeId); cmbCashOrParty.SelectedValue = dtblMaster.Rows[0]["ledgerId"].ToString(); cmbSalesAccount.SelectedValue = dtblMaster.Rows[0]["salesAccount"].ToString(); cmbSalesMan.SelectedValue = dtblMaster.Rows[0]["employeeId"].ToString(); txtCustomer.Text = dtblMaster.Rows[0]["customerName"].ToString(); txtTransportCompany.Text = dtblMaster.Rows[0]["transportationCompany"].ToString(); txtVehicleNo.Text = dtblMaster.Rows[0]["lrNo"].ToString(); txtNarration.Text = dtblMaster.Rows[0]["narration"].ToString(); cmbCurrency.SelectedValue = Convert.ToDecimal(dtblMaster.Rows[0]["exchangeRateId"].ToString()); txtTotalAmount.Text = dtblMaster.Rows[0]["totalAmount"].ToString(); lblTaxTotalAmount.Text = dtblMaster.Rows[0]["taxAmount"].ToString(); cmbPricingLevel.SelectedValue = Convert.ToDecimal(dtblMaster.Rows[0]["pricingLevelId"].ToString()); if (dtblMaster.Rows[0]["quotationMasterId"].ToString() != "0") { cmbSalesMode.Text = "Against Quotation"; againstOrderComboFill(); cmbSalesModeOrderNo.SelectedValue = dtblMaster.Rows[0]["quotationMasterId"].ToString(); lblSalesModeOrderNo.Text = "Quotation No"; cmbCurrency.Enabled = false; cmbPricingLevel.Enabled = false; } else if (dtblMaster.Rows[0]["orderMasterId"].ToString() != "0") { cmbSalesMode.Text = "Against SalesOrder"; againstOrderComboFill(); cmbSalesModeOrderNo.SelectedValue = dtblMaster.Rows[0]["orderMasterId"].ToString(); lblSalesModeOrderNo.Text = "Order No"; cmbCurrency.Enabled = false; cmbPricingLevel.Enabled = false; } else if (dtblMaster.Rows[0]["deliveryNoteMasterId"].ToString() != "0") { cmbSalesMode.Text = "Against Delivery Note"; againstOrderComboFill(); cmbSalesModeOrderNo.SelectedValue = dtblMaster.Rows[0]["deliveryNoteMasterId"].ToString(); lblSalesModeOrderNo.Text = "Delivery Note No"; cmbCurrency.Enabled = false; cmbPricingLevel.Enabled = false; } else { cmbSalesMode.SelectedText = "NA"; } if (txtInvoiceNo.Enabled) { txtDate.Focus(); } else { txtInvoiceNo.Focus(); } DataTable dtblDetails = new DataTable(); dtblDetails = spSalesDetails.SalesInvoiceSalesDetailsViewBySalesMasterId(decSalesInvoiceIdToEdit); dgvSalesInvoiceTaxComboFill(); dgvSalesInvoice.Rows.Clear(); for (int i = 0; i < dtblDetails.Rows.Count; i++) { dgvSalesInvoice.Rows.Add(); IsSetGridValueChange = false; dgvSalesInvoice.Rows[i].HeaderCell.Value = string.Empty; dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesDetailsId"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["salesDetailsId"].ToString()); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSlno"].Value = dtblDetails.Rows[i]["slNo"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceBarcode"].Value = dtblDetails.Rows[i]["barcode"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductCode"].Value = dtblDetails.Rows[i]["productCode"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductName"].Value = dtblDetails.Rows[i]["productName"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductId"].Value = dtblDetails.Rows[i]["productId"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceBrand"].Value = dtblDetails.Rows[i]["brandName"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceQty"].Value = dtblDetails.Rows[i]["qty"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoicePurchaseRate"].Value = dtblDetails.Rows[i]["purchaseRate"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceAmount"].Value = dtblDetails.Rows[i]["amount"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceGrossValue"].Value = dtblDetails.Rows[i]["grossAmount"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoicembUnitName"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["unitId"].ToString()); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceRate"].Value = dtblDetails.Rows[i]["rate"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceGodown"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["godownId"].ToString()); RackComboFill(Convert.ToDecimal(dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceGodown"].Value.ToString()), i, dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceRack"].ColumnIndex); dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceRack"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["rackId"].ToString()); if (dtblDetails.Rows[i]["batchId"] != null && dtblDetails.Rows[i]["batchId"].ToString() != string.Empty) { dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceBatch"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["batchId"].ToString()); } else { dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceBatch"].Value = string.Empty; } dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceMrp"].Value = dtblDetails.Rows[i]["mrp"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesRate"].Value = dtblDetails.Rows[i]["salesRate"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceDiscountAmount"].Value = dtblDetails.Rows[i]["discount"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceNetAmount"].Value = dtblDetails.Rows[i]["netAmount"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceTaxName"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["taxId"].ToString()); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceTaxAmount"].Value = dtblDetails.Rows[i]["taxAmount"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceUnitConversionId"].Value = dtblDetails.Rows[i]["unitConversionId"].ToString(); lblTotalQuantitydisplay.Text = dtblDetails.Rows[i]["qty"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSISalesOrderDetailsId"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["orderDetailsId"].ToString()); // here get fill the grid colum for the editing prps dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceDeliveryNoteDetailsId"].Value = dtblDetails.Rows[i]["deliveryNoteDetailsId"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceQuotationDetailsId"].Value = dtblDetails.Rows[i]["quotationDetailsId"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceVoucherTypeId"].Value = Convert.ToDecimal(dtblDetails.Rows[i]["voucherTypeRefNo"].ToString()); // here get fill the grid colum for the editing prps dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceVoucherNo"].Value = dtblDetails.Rows[i]["voucherRefNo"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceInvoiceNo"].Value = dtblDetails.Rows[i]["invoiceRefNo"].ToString(); dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceBarcode"].ReadOnly = true; dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductCode"].ReadOnly = true; dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceProductName"].ReadOnly = true; dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceBrand"].ReadOnly = true; dgvSalesInvoice.Rows[i].Cells["dgvcmbSalesInvoiceBatch"].ReadOnly = true; if (cmbSalesMode.SelectedIndex != 0) { strVoucherNoTostockPost = dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceVoucherNo"].Value.ToString(); strInvoiceNoTostockPost = dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceInvoiceNo"].Value.ToString(); decVouchertypeIdTostockPost = Convert.ToDecimal(dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceVoucherTypeId"].Value); } GrossValueCalculation(i); DiscountCalculation(i, dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceDiscountAmount"].ColumnIndex); taxAndGridTotalAmountCalculation(i); decCurrentRate = Convert.ToDecimal(dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceRate"].Value.ToString()); decCurrentConversionRate = Convert.ToDecimal(dtblDetails.Rows[i]["conversionRate"].ToString()); UnitConversionCalc(i); if (cmbSalesModeOrderNo.Visible == true) { dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoicembUnitName"].ReadOnly = true; } } DataTable dtblAdditionalCost = new DataTable(); dtblAdditionalCost = spSalesMaster.SalesInvoiceAdditionalCostViewByVoucherNoUnderVoucherType(DecSalesInvoiceVoucherTypeId, strVoucherNo); for (int i = 0; i < dtblAdditionalCost.Rows.Count; i++) { dgvSalesInvoiceLedger.Rows.Add(); dgvSalesInvoiceLedger.Rows[i].Cells["dgvtxtAdditionalCostId"].Value = dtblAdditionalCost.Rows[i]["additionalCostId"].ToString(); dgvSalesInvoiceLedger.Rows[i].Cells["dgvCmbAdditionalCostledgerName"].Value = Convert.ToDecimal(dtblAdditionalCost.Rows[i]["ledgerId"].ToString()); dgvSalesInvoiceLedger.Rows[i].Cells["dgvtxtAdditionalCoastledgerAmount"].Value = dtblAdditionalCost.Rows[i]["amount"].ToString(); DataTable dtblAdcostForView = new DataTable(); AccountLedgerSP SpAccountLedger = new AccountLedgerSP(); dtblAdcostForView = SpAccountLedger.AccountLedgerViewForAdditionalCost(); DataGridViewComboBoxCell dgvccVoucherType = (DataGridViewComboBoxCell)dgvSalesInvoiceLedger[dgvSalesInvoiceLedger.Columns["dgvCmbAdditionalCostledgerName"].Index, i]; dgvccVoucherType.DataSource = dtblAdcostForView; dgvccVoucherType.ValueMember = "ledgerId"; dgvccVoucherType.DisplayMember = "ledgerName"; } DataTable dtblDrOrCr = spSalesMaster.salesinvoiceAdditionalCostCheckdrOrCrforSiEdit(DecSalesInvoiceVoucherTypeId, strVoucherNo); if (dtblDrOrCr.Rows.Count > 0) { if (Convert.ToDecimal(dtblDrOrCr.Rows[0]["credit"].ToString()) != 0) { cmbCashOrbank.SelectedValue = Convert.ToDecimal(dtblDrOrCr.Rows[0]["ledgerId"].ToString()); cmbCashOrbank.Visible = true; lblcashOrBank.Visible = true; cmbDrorCr.SelectedIndex = 0; decBankOrCashIdForEdit = Convert.ToDecimal(cmbCashOrbank.SelectedValue.ToString()); } else { cmbDrorCr.SelectedIndex = 1; } } taxGridFill(); DataTable dtblTax = new DataTable(); dtblTax = spSalesBillTax.SalesInvoiceSalesBillTaxViewAllBySalesMasterId(decSalesInvoiceIdToEdit); foreach (DataGridViewRow dgvrowTax in dgvSalesInvoiceTax.Rows) { for (int ini = 0; ini < dtblTax.Rows.Count; ini++) { if (dgvrowTax.Cells["dgvtxtTtaxId"].Value != null && dgvrowTax.Cells["dgvtxtTtaxId"].Value.ToString() != string.Empty) { decimal decId = Convert.ToDecimal(dtblTax.Rows[ini]["taxId"].ToString()); if (dgvrowTax.Cells["dgvtxtTtaxId"].Value.ToString() == decId.ToString()) { dgvrowTax.Cells["dgvtxtTtaxAmount"].Value = dtblTax.Rows[ini]["taxAmount"].ToString(); break; } else { dgvrowTax.Cells["dgvtxtTtaxAmount"].Value = "0.00"; } } } } LedgerGridTotalAmountCalculation(); SiGridTotalAmountCalculation(); txtGrandTotal.Text = dtblMaster.Rows[0]["grandTotal"].ToString(); txtBillDiscount.Text = dtblMaster.Rows[0]["billDiscount"].ToString(); bool isPartyBalanceRef = false; AccountLedgerSP spAccountLedger = new AccountLedgerSP(); PartyBalanceSP spPartyBalance = new PartyBalanceSP(); isPartyBalanceRef = spAccountLedger.PartyBalanceAgainstReferenceCheck(strVoucherNo, DecSalesInvoiceVoucherTypeId); if (isPartyBalanceRef) { cmbCashOrParty.Enabled = false; } else { cmbCashOrParty.Enabled = true; } //if (!spPartyBalance.PartyBalanceCheckReference(DecSalesInvoiceVoucherTypeId, strVoucherNo)) //{ // cmbCashOrParty.Enabled = false; //} //else //{ // cmbCashOrParty.Enabled = true; //} } catch (Exception ex) { MessageBox.Show("SI: 77" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Fill function for updation /// </summary> public void FillFunction() { try { PhysicalStockMasterInfo infoPhysicalStockMaster = new PhysicalStockMasterInfo(); PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP(); VoucherTypeSP spVoucherType = new VoucherTypeSP(); infoPhysicalStockMaster = spPhysicalStockMaster.PhysicalStockMasterView(decMasterId); txtVoucherNo.Text = infoPhysicalStockMaster.InvoiceNo; strVoucherNo = infoPhysicalStockMaster.VoucherNo.ToString(); decPhysicalStockSuffixPrefixId = Convert.ToDecimal(infoPhysicalStockMaster.SuffixPrefixId); decPhysicalStockVoucherTypeId = Convert.ToDecimal(infoPhysicalStockMaster.VoucherTypeId); isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decPhysicalStockVoucherTypeId); txtDate.Text = infoPhysicalStockMaster.Date.ToString("dd-MMM-yyyy"); txtNarration.Text = infoPhysicalStockMaster.Narration; txtTotalAmount.Text = infoPhysicalStockMaster.TotalAmount.ToString(); DataTable dtbl = new DataTable(); dtbl = spPhysicalStockMaster.PhysicalStockViewbyMasterId(decMasterId); isFromEditMode = true; for (int i = 0; i < dtbl.Rows.Count; i++) { dgvPhysicalStock.Rows.Add(); dgvPhysicalStock.Rows[i].HeaderCell.Value = string.Empty; dgvPhysicalStock.Rows[i].Cells["dgvtxtPhysicalStockDetailId"].Value = Convert.ToDecimal(dtbl.Rows[i]["physicalStockDetailsId"].ToString()); dgvPhysicalStock.Rows[i].Cells["dgvtxtSlNo"].Value = dtbl.Rows[i]["slno"].ToString(); dgvPhysicalStock.Rows[i].Cells["dgvtxtProductCode"].Value = dtbl.Rows[i]["productCode"].ToString(); dgvPhysicalStock.Rows[i].Cells["dgvtxtProductName"].Value = dtbl.Rows[i]["productName"].ToString(); dgvPhysicalStock.Rows[i].Cells["dgvtxtQty"].Value = dtbl.Rows[i]["qty"].ToString(); BatchComboFill(Convert.ToDecimal(dtbl.Rows[i]["productId"].ToString()), i, dgvPhysicalStock.Rows[i].Cells["dgvcmbBatch"].ColumnIndex); dgvPhysicalStock.Rows[i].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(dtbl.Rows[i]["batchId"].ToString()); dgvPhysicalStock.Rows[i].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(dtbl.Rows[i]["unitId"].ToString()); dgvPhysicalStock.Rows[i].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(dtbl.Rows[i]["godownId"].ToString()); dgvPhysicalStock.Rows[i].Cells["dgvcmbRack"].Value = Convert.ToDecimal(dtbl.Rows[i]["rackId"].ToString()); dgvPhysicalStock.Rows[i].Cells["dgvtxtRate"].Value = dtbl.Rows[i]["rate"].ToString(); dgvPhysicalStock.Rows[i].Cells["dgvtxtAmount"].Value = dtbl.Rows[i]["amount"].ToString(); dgvPhysicalStock.Rows[i].Cells["dgvtxtBarcode"].Value = dtbl.Rows[i]["barcode"].ToString(); if (dgvPhysicalStock.Columns.Count > 0) { dgvPhysicalStock.Columns["dgvtxtRate"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dgvPhysicalStock.Columns["dgvtxtAmount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; } } isFromEditMode = false; } catch (Exception ex) { MessageBox.Show("PS:8" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// To fill the details according to the DeliveryNote master Id from frmDeliveryNoteRegister and frmDeliveryNoteReport /// </summary> public void FillRegisterOrReport() { try { DeliveryNoteMasterInfo infoDeliveryNoteMaster = new DeliveryNoteMasterInfo(); VoucherTypeInfo infoVoucherType = new VoucherTypeInfo(); VoucherTypeSP spVoucherType = new VoucherTypeSP(); DeliveryNoteMasterSP spDeliveryNoteMaster = new DeliveryNoteMasterSP(); DeliveryNoteDetailsSP spDeliveryNoteDetails = new DeliveryNoteDetailsSP(); SalesOrderMasterInfo infoSalesOrderMaster = new SalesOrderMasterInfo(); SalesOrderMasterSP spSalesOrderMaster = new SalesOrderMasterSP(); SalesQuotationMasterInfo infoSalesQuotationMaster = new SalesQuotationMasterInfo(); SalesQuotationMasterSP spSalesQuotationMaster = new SalesQuotationMasterSP(); dgvProduct.Rows.Clear(); isRegisterReportFill = true; btnSave.Text = "Update"; int inRowIndex = 0; btnDelete.Enabled = true; txtDeliveryNoteNo.ReadOnly = true; if (txtDeliveryNoteNo.ReadOnly == true) { txtDate.Focus(); } else { txtDeliveryNoteNo.Focus(); } infoDeliveryNoteMaster = spDeliveryNoteMaster.DeliveryNoteMasterViewAllByMasterId(decDelivryNoteIdToEdit); txtDeliveryNoteNo.Text = infoDeliveryNoteMaster.InvoiceNo; strVoucherNo = infoDeliveryNoteMaster.VoucherNo.ToString(); decDeliveryNoteSuffixPrefixId = Convert.ToDecimal(infoDeliveryNoteMaster.SuffixPrefixId); decDeliveryNoteVoucherTypeId = Convert.ToDecimal(infoDeliveryNoteMaster.VoucherTypeId); isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decDeliveryNoteVoucherTypeId); decDeliveryNoteTypeId = decDeliveryNoteVoucherTypeId; cmbCashOrParty.SelectedValue = infoDeliveryNoteMaster.LedgerId; txtDate.Text = infoDeliveryNoteMaster.Date.ToString("dd-MMM-yyyy"); cmbPricingLevel.SelectedValue = infoDeliveryNoteMaster.PricinglevelId; infoVoucherType = spVoucherType.VoucherTypeView(decDeliveryNoteVoucherTypeId); this.Text = infoVoucherType.VoucherTypeName; if (infoDeliveryNoteMaster.OrderMasterId != 0) { cmbDeliveryMode.Text = "Against Order"; infoSalesOrderMaster = spSalesOrderMaster.SalesOrderMasterView(infoDeliveryNoteMaster.OrderMasterId); cmbType.SelectedValue = infoSalesOrderMaster.VoucherTypeId; AgainstOrderComboFill(); cmbOrderNo.SelectedValue = infoDeliveryNoteMaster.OrderMasterId; } else if (infoDeliveryNoteMaster.QuotationMasterId != 0) { cmbDeliveryMode.Text = "Against Quotation"; infoSalesQuotationMaster = spSalesQuotationMaster.SalesQuotationMasterView(infoDeliveryNoteMaster.QuotationMasterId); cmbType.SelectedValue = infoSalesQuotationMaster.VoucherTypeId; AgainstQuotationComboFill(); cmbOrderNo.SelectedValue = infoDeliveryNoteMaster.QuotationMasterId; } CurrencyComboFill(); cmbSalesMan.SelectedValue = infoDeliveryNoteMaster.EmployeeId; cmbCurrency.SelectedValue = infoDeliveryNoteMaster.ExchangeRateId; txtTraspotationCompany.Text = infoDeliveryNoteMaster.TransportationCompany; txtNarration.Text = infoDeliveryNoteMaster.Narration; txtLRNo.Text = infoDeliveryNoteMaster.LrNo; txtTotalAmnt.Text = infoDeliveryNoteMaster.TotalAmount.ToString("00.00"); DataTable dtblDetails = spDeliveryNoteDetails.DeliveryNoteDetailsViewByDeliveryNoteMasterId(decDelivryNoteIdToEdit); foreach (DataRow drowDetails in dtblDetails.Rows) { dgvProduct.Rows.Add(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtBarcode"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtBarcode"].Value = drowDetails["barcode"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtDetailsId"].Value = drowDetails["deliveryNoteDetailsId"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtVoucherNo"].Value = drowDetails["VoucherNo"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtInvoiceNo"].Value = drowDetails["OrderNoOrQuotationNo"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtVoucherTypeId"].Value = drowDetails["VoucherTypeId"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductId"].Value = drowDetails["productId"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductCode"].Value = drowDetails["productCode"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductName"].Value = drowDetails["productName"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["Col"].Value = drowDetails["slNo"].ToString(); if (Convert.ToDecimal(drowDetails["orderDetails1Id"].ToString()) == 0) { dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtOrderDetailsId"].Value = 0; } else { dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtOrderDetailsId"].Value = Convert.ToDecimal(drowDetails["orderDetails1Id"].ToString()); } if (Convert.ToDecimal(drowDetails["quotationDetails1Id"].ToString()) != 0) { dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtOrderDetailsId"].Value = Convert.ToDecimal(drowDetails["quotationDetails1Id"].ToString()); } BatchComboFill(Convert.ToDecimal(drowDetails["productId"].ToString()), dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbBatch"].ColumnIndex); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(drowDetails["batchId"].ToString()); UnitComboFill1(Convert.ToDecimal(drowDetails["productId"].ToString()), dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ColumnIndex); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(drowDetails["unitId"].ToString()); GridGodownComboFill(Convert.ToDecimal(drowDetails["productId"].ToString()), dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbGodown"].ColumnIndex); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(drowDetails["godownId"].ToString()); RackComboFill1(Convert.ToDecimal(drowDetails["godownId"].ToString()), dgvProduct.Rows.Count - 2, dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbRack"].ColumnIndex); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbRack"].Value = Convert.ToDecimal(drowDetails["rackId"].ToString()); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtQty"].Value = drowDetails["qty"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtRate"].Value = drowDetails["rate"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtUnitConversionId"].Value = drowDetails["unitConversionId"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtConversionRate"].Value = drowDetails["conversionRate"].ToString(); dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtAmount"].Value = drowDetails["amount"].ToString(); if (cmbOrderNo.Visible == true) { dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ReadOnly = true; } if (spDeliveryNoteMaster.DeliveryNoteMasterReferenceCheckRejectionIn(decDelivryNoteIdToEdit)) { dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtBarcode"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductCode"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtProductName"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbBatch"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbGodown"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbRack"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvtxtRate"].ReadOnly = true; dgvProduct.Rows[dgvProduct.Rows.Count - 2].Cells["dgvcmbUnit"].ReadOnly = true; } dgvProduct.Rows[dgvProduct.Rows.Count - 2].HeaderCell.Value = ""; AmountCalculation("dgvtxtQty", inRowIndex); TotalAmountCalculation(); } if (!isAutomatic) { txtDeliveryNoteNo.ReadOnly = false; txtDeliveryNoteNo.Focus(); } isRegisterReportFill = false; isDoAfterGridFill = true; } catch (Exception ex) { MessageBox.Show("DN19: " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the details while calling from register or report /// </summary> public void FillRegisterOrReport() { StockJournalMasterSP spStockJournalMaster = new StockJournalMasterSP(); StockJournalDetailsSP spStockJournalDetails = new StockJournalDetailsSP(); StockJournalMasterInfo infoStockJournalMaster = new StockJournalMasterInfo(); StockJournalDetailsInfo infoStockJournalDetails = new StockJournalDetailsInfo(); AdditionalCostSP spAdditionalCost = new AdditionalCostSP(); VoucherTypeSP spVoucherType = new VoucherTypeSP(); try { isFillMode = true; btnSave.Text = "Update"; cmbFinishedGoods.Enabled = false; txtQty.Enabled = false; btnAdd.Enabled = false; dgvConsumption.Rows.Clear(); dgvProduction.Rows.Clear(); dgvAdditionalCost.Rows.Clear(); DataTable dtblMaster = spStockJournalMaster.StockJournalMasterFillForRegisterOrReport(decStockJournalMasterIdForEdit); StockJournalVoucherTypeId = Convert.ToDecimal(dtblMaster.Rows[0]["voucherTypeId"].ToString()); VoucherTypeInfo infoVoucherType = new VoucherTypeInfo(); infoVoucherType = spVoucherType.VoucherTypeView(StockJournalVoucherTypeId); this.Text = infoVoucherType.VoucherTypeName; txtDate.Text = dtblMaster.Rows[0]["date"].ToString(); strVoucherNo = dtblMaster.Rows[0]["voucherNo"].ToString(); decSuffixPrefixId = Convert.ToDecimal(dtblMaster.Rows[0]["suffixPrefixId"].ToString()); decVoucherTypeId = Convert.ToDecimal(dtblMaster.Rows[0]["voucherTypeId"].ToString()); isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(StockJournalVoucherTypeId); dtpDate.Value = Convert.ToDateTime(txtDate.Text); txtNarration.Text = dtblMaster.Rows[0]["narration"].ToString(); cmbCurrency.SelectedValue = Convert.ToDecimal(dtblMaster.Rows[0]["exchangeRateId"].ToString()); if (dtblMaster.Rows[0]["extra1"].ToString() == "Manufacturing") { rbtnManufacturing.Checked = true; } if (dtblMaster.Rows[0]["extra1"].ToString() == "Transfer") { rbtnTransfer.Checked = true; } if (dtblMaster.Rows[0]["extra1"].ToString() == "Stock Out") { rbtnStockOut.Checked = true; } txtVoucherNo.Text = dtblMaster.Rows[0]["invoiceNo"].ToString(); DataSet dsDetails = spStockJournalDetails.StockJournalDetailsForRegisterOrReport(decStockJournalMasterIdForEdit); DataTable dtblConsumption = dsDetails.Tables[0]; if (dsDetails.Tables[0].Rows.Count > 0) { for (int i = 0; i < dtblConsumption.Rows.Count; i++) { dgvConsumption.Rows.Add(); dgvConsumption.Rows[i].HeaderCell.Value = string.Empty; dgvConsumption.Rows[i].Cells["dgvtxtConsumptionStockJournalDetailsId"].Value = Convert.ToDecimal(dtblConsumption.Rows[i]["stockJournalDetailsId"].ToString()); dgvConsumption.Rows[i].Cells["dgvtxtConsumptionSlNo"].Value = dtblConsumption.Rows[i]["slno"].ToString(); dgvConsumption.Rows[i].Cells["dgvtxtConsumptionBarcode"].Value = dtblConsumption.Rows[i]["barcode"].ToString(); dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductCode"].Value = dtblConsumption.Rows[i]["productCode"].ToString(); dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductName"].Value = dtblConsumption.Rows[i]["productName"].ToString(); dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductId"].Value = dtblConsumption.Rows[i]["productId"].ToString(); IsSetGridValueChange = true; dgvConsumption.Rows[i].Cells["dgvtxtConsumptionQty"].Value = dtblConsumption.Rows[i]["qty"].ToString(); IsSetGridValueChange = false; dgvConsumption.Rows[i].Cells["dgvcmbConsumptionGodown"].Value = Convert.ToDecimal(dtblConsumption.Rows[i]["godownId"].ToString()); dgvConsumption.Rows[i].Cells["dgvcmbConsumptionRack"].Value = Convert.ToDecimal(dtblConsumption.Rows[i]["rackId"].ToString()); if (dtblConsumption.Rows[i]["batchId"] != null && dtblConsumption.Rows[i]["batchId"].ToString() != "0") { dgvConsumption.Rows[i].Cells["dgvcmbConsumptionBatch"].Value = Convert.ToDecimal(dtblConsumption.Rows[i]["batchId"].ToString()); } else { dgvConsumption.Rows[i].Cells["dgvcmbConsumptionBatch"].Value = string.Empty; } IsSetGridValueChange = true; dgvConsumption.Rows[i].Cells["dgvcmbConsumptionunitId"].Value = Convert.ToDecimal(dtblConsumption.Rows[i]["unitId"].ToString()); IsSetGridValueChange = false; dgvConsumption.Rows[i].Cells["dgvtxtConsumptionUnitConversionId"].Value = dtblConsumption.Rows[i]["unitConversionId"].ToString(); dgvConsumption.Rows[i].Cells["dgvtxtConsumptionBarcode"].ReadOnly = true; dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductCode"].ReadOnly = true; dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductName"].ReadOnly = true; dgvConsumption.Rows[i].Cells["dgvtxtConsumptionRate"].Value = dtblConsumption.Rows[i]["rate"].ToString(); dgvConsumption.Rows[i].Cells["dgvtxtConsumptionAmount"].Value = dtblConsumption.Rows[i]["amount"].ToString(); dgvConsumption.Rows[i].HeaderCell.Value = ""; } } DataTable dtblProduction = dsDetails.Tables[1]; for (int i = 0; i < dtblProduction.Rows.Count; i++) { dgvProduction.Rows.Add(); dgvProduction.Rows[i].HeaderCell.Value = string.Empty; dgvProduction.Rows[i].Cells["dgvtxtProductionStockJournalDetailsId"].Value = Convert.ToDecimal(dtblProduction.Rows[i]["stockJournalDetailsId"].ToString()); dgvProduction.Rows[i].Cells["dgvtxtProductionSlNo"].Value = dtblProduction.Rows[i]["slno"].ToString(); dgvProduction.Rows[i].Cells["dgvtxtProductionBarcode"].Value = dtblProduction.Rows[i]["barcode"].ToString(); dgvProduction.Rows[i].Cells["dgvtxtProductionProductCode"].Value = dtblProduction.Rows[i]["productCode"].ToString(); dgvProduction.Rows[i].Cells["dgvtxtProductionProductName"].Value = dtblProduction.Rows[i]["productName"].ToString(); dgvProduction.Rows[i].Cells["dgvtxtProductionProductId"].Value = dtblProduction.Rows[i]["productId"].ToString(); IsSetGridValueChange = true; dgvProduction.Rows[i].Cells["dgvtxtProductionQty"].Value = dtblProduction.Rows[i]["qty"].ToString(); IsSetGridValueChange = false; if (rbtnManufacturing.Checked) { cmbFinishedGoods.SelectedValue = dgvProduction.Rows[i].Cells["dgvtxtProductionProductId"].Value; if (cmbFinishedGoods.SelectedValue != null) { cmbFinishedGoods.Enabled = true; txtQty.Enabled = true; btnAdd.Enabled = true; txtQty.Text = dtblProduction.Rows[i]["qty"].ToString(); } } dgvProduction.Rows[i].Cells["dgvcmbProductionGodown"].Value = Convert.ToDecimal(dtblProduction.Rows[i]["godownId"].ToString()); dgvProduction.Rows[i].Cells["dgvcmbProductionRack"].Value = Convert.ToDecimal(dtblProduction.Rows[i]["rackId"].ToString()); if (dtblProduction.Rows[i]["batchId"] != null && dtblProduction.Rows[i]["batchId"].ToString() != string.Empty) { dgvProduction.Rows[i].Cells["dgvcmbProductionBatch"].Value = Convert.ToDecimal(dtblProduction.Rows[i]["batchId"].ToString()); } else { dgvProduction.Rows[i].Cells["dgvcmbProductionBatch"].Value = string.Empty; } IsSetGridValueChange = true; dgvProduction.Rows[i].Cells["dgvcmbProductionunitId"].Value = Convert.ToDecimal(dtblProduction.Rows[i]["unitId"].ToString()); IsSetGridValueChange = false; dgvProduction.Rows[i].Cells["dgvtxtProductionUnitConversionId"].Value = dtblProduction.Rows[i]["unitConversionId"].ToString(); dgvProduction.Rows[i].Cells["dgvtxtProductionBarcode"].ReadOnly = true; dgvProduction.Rows[i].Cells["dgvtxtProductionProductCode"].ReadOnly = true; dgvProduction.Rows[i].Cells["dgvtxtProductionProductName"].ReadOnly = true; dgvProduction.Rows[i].Cells["dgvtxtProductionRate"].Value = dtblProduction.Rows[i]["rate"].ToString(); dgvProduction.Rows[i].Cells["dgvtxtProductionAmount"].Value = dtblProduction.Rows[i]["amount"].ToString(); } DataSet dsAdditionalCost = spAdditionalCost.StockJournalAdditionalCostForRegisteOrReport(strVoucherNo, decVoucherTypeId); if (dsAdditionalCost.Tables[0].Rows.Count > 0) { DataTable dtblCashOrBank = dsAdditionalCost.Tables[0]; cmbCashOrBank.SelectedValue = Convert.ToDecimal(dtblCashOrBank.Rows[0]["ledgerId"]); } if (dsAdditionalCost.Tables[1].Rows.Count > 0) { DataTable dtblIndirectExpenses = dsAdditionalCost.Tables[1]; int inRowIndexAdditional = 0; for (int i = 0; i < dtblIndirectExpenses.Rows.Count; i++) { dgvAdditionalCost.Rows.Add(); dgvAdditionalCost.Rows[i].HeaderCell.Value = string.Empty; dgvAdditionalCost.Rows[i].Cells["dgvtxtAdditionalCostSlNo"].Value = ++inRowIndexAdditional; dgvAdditionalCost.Rows[i].Cells["dgvcmbAdditionalCostLedger"].Value = Convert.ToDecimal(dtblIndirectExpenses.Rows[i]["ledgerId"].ToString()); dgvAdditionalCost.Rows[i].Cells["dgvtxtAdditionalCostAmount"].Value = dtblIndirectExpenses.Rows[i]["debit"].ToString(); } } grandTotalAmountCalculationConsumption(); grandTotalAmountCalculationProduction(); TotalAdditionalCostAmount(); btnDelete.Enabled = true; if (isAutomatic) { txtVoucherNo.ReadOnly = true; } else { txtVoucherNo.ReadOnly = false; } gbxTransactionType.Enabled = false; isFillMode = false; } catch (Exception ex) { MessageBox.Show("SJ:50" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call this form from frmVoucherTypeSelection form /// </summary> /// <param name="decVoucherTypeId"></param> /// <param name="strVoucherTypeName"></param> public void CallFromVoucherTypeSelection(decimal decVoucherTypeId, string strVoucherTypeName) { try { decMonthlyVoucherTypeId = decVoucherTypeId; VoucherTypeSP spVoucherType = new VoucherTypeSP(); isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decMonthlyVoucherTypeId); SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(decMonthlyVoucherTypeId, dtpVoucherDate.Value); decMonthlySuffixPrefixId = infoSuffixPrefix.SuffixprefixId; this.Text = strVoucherTypeName; base.Show(); if (isAutomatic) { txtVoucherDate.Focus(); } else { txtVoucherNo.Focus(); } } catch (Exception ex) { MessageBox.Show("MSV3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On print button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { frmReport crptReport = new frmReport(); DataSet ds = new DataSet(); DataTable dtblFormat2 = new DataTable(); DataTable dtblTotal = new DataTable(); CompanySP spCompany = new CompanySP(); DataTable dtblCompany = new DataTable(); dtblCompany = spCompany.CompanyViewAll(); if (dgvVatreturn.Rows.Count > 0) { if (dtblFill.Rows.Count > 0) { DataTable dtblReportFill = new DataTable(); dtblReportFill.Columns.Add("SlNO"); dtblReportFill.Columns.Add("Invoice No"); dtblReportFill.Columns.Add("Date"); dtblReportFill.Columns.Add("Party Name"); dtblReportFill.Columns.Add("Mailing Name"); dtblReportFill.Columns.Add("Tin No"); dtblReportFill.Columns.Add("qt"); dtblReportFill.Columns.Add("Sales Amound"); dtblReportFill.Columns.Add("Tax Amount"); dtblReportFill.Columns.Add("Cess"); dtblReportFill.Columns.Add("Net Amount"); dtblReportFill.Columns.Add("billDiscount"); dtblReportFill.Columns.Add("grandtotal"); for (int i = 0; i < dgvVatreturn.Rows.Count; i++) { DataRow drow = dtblReportFill.NewRow(); if (dgvVatreturn.Rows[i].Cells["dgvtxtSlno"].Value != null) { drow["SlNO"] = dgvVatreturn.Rows[i].Cells["dgvtxtSlno"].Value.ToString(); } if (dgvVatreturn.Rows[i].Cells["dgvtxtInvoiceNo"].Value != null) { drow["Invoice No"] = dgvVatreturn.Rows[i].Cells["dgvtxtInvoiceNo"].Value.ToString(); } if (dgvVatreturn.Rows[i].Cells["dgvtxtDate"].Value != null) { drow["Date"] = dgvVatreturn.Rows[i].Cells["dgvtxtDate"].Value.ToString(); } if (dgvVatreturn.Rows[i].Cells["dgvtxtPartyName"].Value != null) { drow["Party Name"] = dgvVatreturn.Rows[i].Cells["dgvtxtPartyName"].Value.ToString(); } if (dgvVatreturn.Rows[i].Cells["dgvtxtMailingName"].Value.ToString() != string.Empty) { drow["Mailing Name"] = dgvVatreturn.Rows[i].Cells["dgvtxtMailingName"].Value.ToString(); } if (dgvVatreturn.Rows[i].Cells["dgvtxtTinNo"].Value != null) { drow["Tin No"] = dgvVatreturn.Rows[i].Cells["dgvtxtTinNo"].Value.ToString(); } if (dgvVatreturn.Rows[i].Cells["dgvtxtQty"].Value != null) { drow["qt"] = dgvVatreturn.Rows[i].Cells["dgvtxtQty"].Value.ToString(); } if (dgvVatreturn.Rows[i].Cells["dgvtxtSalesAmount"].Value != null) { drow["Sales Amound"] = dgvVatreturn.Rows[i].Cells["dgvtxtSalesAmount"].Value.ToString(); } if (dgvVatreturn.Rows[i].Cells["dgvtxtTaxAmount"].Value != null) { drow["Tax Amount"] = dgvVatreturn.Rows[i].Cells["dgvtxtTaxAmount"].Value.ToString(); } if (dgvVatreturn.Rows[i].Cells["dgvtxtCess"].Value != null) { drow["Cess"] = dgvVatreturn.Rows[i].Cells["dgvtxtCess"].Value.ToString(); } if (dgvVatreturn.Rows[i].Cells["dgvtxtNetAmount"].Value != null) { drow["Net Amount"] = dgvVatreturn.Rows[i].Cells["dgvtxtNetAmount"].Value.ToString(); } if (dgvVatreturn.Rows[i].Cells["dgvtxtbillDiscount"].Value != null) { drow["billDiscount"] = dgvVatreturn.Rows[i].Cells["dgvtxtbillDiscount"].Value.ToString(); } if (dgvVatreturn.Rows[i].Cells["dgvtxtGrandTotal"].Value != null) { drow["grandtotal"] = dgvVatreturn.Rows[i].Cells["dgvtxtGrandTotal"].Value.ToString(); } dtblReportFill.Rows.Add(drow); } ds.Tables.Add(dtblReportFill); ds.Tables.Add(dtblCompany); crptReport.vatreturnReport(ds); } else { VoucherTypeSP spVoucher = new VoucherTypeSP(); dtblFormat2 = spVoucher.VatGridFill(DateTime.Parse(dtpFrmDate.Text), DateTime.Parse(dtpToDate.Text), cmbTypeofVoucher.Text, Convert.ToDecimal(cmbVouchertype.SelectedValue.ToString()), strformat, cmbTax.Text); if (dgvVatreturn.Rows.Count > 1) { dtblTotal.Columns.Add("taxableamt"); dtblTotal.Columns.Add("taxAmount"); DataRow dr1 = dtblTotal.NewRow(); dr1["taxableamt"] = dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 2].Cells["dgvtxtTaxableAmount"].Value.ToString(); dr1["taxAmount"] = dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 2].Cells["dgvtxttax"].Value.ToString(); dtblTotal.Rows.Add(dr1); ds.Tables.Add(dtblCompany); ds.Tables.Add(dtblFormat2); ds.Tables.Add(dtblTotal); crptReport.vatreturnReportFormat(ds); } } } else { MessageBox.Show("No data found", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show("VRR:14" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Voucher Type Combobox Fill /// </summary> public void VoucherTypeComboFill() { try { DataTable dtblVouchetType = new DataTable(); VoucherTypeSP SpVoucherType = new VoucherTypeSP(); dtblVouchetType = SpVoucherType.VoucherTypeSelectionComboFill("Material Receipt"); cmbVoucherType.DataSource = dtblVouchetType; cmbVoucherType.ValueMember = "voucherTypeId"; cmbVoucherType.DisplayMember = "voucherTypeName"; cmbVoucherType.SelectedIndex = -1; } catch (Exception ex) { MessageBox.Show("RO27:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill VoucherType combobox /// </summary> public void VoucherTypeComboFill() { try { DataTable dtblVoucherTypes = new DataTable(); VoucherTypeSP spVoucherType = new VoucherTypeSP(); dtblVoucherTypes = spVoucherType.VoucherTypeSelectionComboFill("Service Voucher"); DataRow dr = dtblVoucherTypes.NewRow(); dr["voucherTypeId"] = 0; dr["voucherTypeName"] = "All"; dtblVoucherTypes.Rows.InsertAt(dr, 0); cmbVoucherType.DataSource = dtblVoucherTypes; cmbVoucherType.DisplayMember = "voucherTypeName"; cmbVoucherType.ValueMember = "voucherTypeId"; cmbVoucherType.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show("SVRT 6 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the grid /// </summary> public void GridFill() { try { dgvVatreturn.Rows.Clear(); DataTable dt = new DataTable(); string strVoucherTypeName = string.Empty; decimal decVoucherTypeId; if (rbtnFormat1.Checked) { strformat = "type1"; } else { strformat = "type2"; } if (cmbVouchertype.Enabled) { decVoucherTypeId = Convert.ToDecimal(cmbVouchertype.SelectedValue.ToString()); } else { decVoucherTypeId = 0; } strVoucherTypeName = Convert.ToString(cmbTypeofVoucher.Text); VoucherTypeSP spVoucher = new VoucherTypeSP(); dt = spVoucher.VatGridFill(Convert.ToDateTime(dtpFrmDate.Text), Convert.ToDateTime(dtpToDate.Text), strVoucherTypeName, decVoucherTypeId, strformat, cmbTax.Text); dtblFill = dt; DataTable dtblTaxName = new DataTable(); dtblTaxName = spVoucher.VatViewTaxNames(); if (rbtnFormat1.Checked) { dgvVatreturn.Columns["dgvtxtTaxName"].Visible = false; dgvVatreturn.Columns["dgvtxtTaxableAmount"].Visible = false; dgvVatreturn.Columns["dgvtxttax"].Visible = false; dgvVatreturn.Columns["dgvtxtQty"].Visible = true; dgvVatreturn.Columns["dgvtxtSalesAmount"].Visible = true; dgvVatreturn.Columns["dgvtxtTaxAmount"].Visible = true; dgvVatreturn.Columns["dgvtxtNetAmount"].Visible = true; dgvVatreturn.Columns["dgvtxtbillDiscount"].Visible = true; foreach (DataRow drowDetails in dt.Rows) { dgvVatreturn.Rows.Add(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtInvoiceNo"].Value = drowDetails["Invoice No"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtDate"].Value = drowDetails["Date"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtPartyName"].Value = drowDetails["Party Name"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtMailingName"].Value = drowDetails["Mailing Name"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtsalesmasterid"].Value = drowDetails["SalesMasterId"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtvoucherName"].Value = drowDetails["voucherName"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtVoucherType"].Value = drowDetails["voucherType"].ToString(); decimal dSaleId = Convert.ToDecimal(dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtsalesmasterid"].Value.ToString()); string strVoucherType = Convert.ToString(dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtVoucherType"].Value); string qt = spVoucher.VoucherreportsumQty(dSaleId, strVoucherType); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtTinNo"].Value = drowDetails["Tin No"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtQty"].Value = qt; dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtSalesAmount"].Value = drowDetails["Sales Amound"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtTaxAmount"].Value = Math.Round(Convert.ToDecimal(drowDetails["Tax Amount"].ToString()), PublicVariables._inNoOfDecimalPlaces).ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtCess"].Value = drowDetails["Cess"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtNetAmount"].Value = Math.Round(Convert.ToDecimal(drowDetails["Net Amount"].ToString()), PublicVariables._inNoOfDecimalPlaces).ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtbillDiscount"].Value = Math.Round(Convert.ToDecimal(drowDetails["billDiscount"].ToString()), PublicVariables._inNoOfDecimalPlaces).ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtGrandTotal"].Value = Math.Round(Convert.ToDecimal(drowDetails["grandtotal"].ToString()), PublicVariables._inNoOfDecimalPlaces).ToString();; } if (dgvVatreturn.Rows.Count > 0) { SerialNo(); } } else { dgvVatreturn.Rows.Clear(); dgvVatreturn.Columns["dgvtxtTaxName"].Visible = true; dgvVatreturn.Columns["dgvtxtTaxableAmount"].Visible = true; dgvVatreturn.Columns["dgvtxttax"].Visible = true; dgvVatreturn.Columns["dgvtxtQty"].Visible = false; dgvVatreturn.Columns["dgvtxtSalesAmount"].Visible = false; dgvVatreturn.Columns["dgvtxtTaxAmount"].Visible = false; dgvVatreturn.Columns["dgvtxtNetAmount"].Visible = false; dgvVatreturn.Columns["dgvtxtbillDiscount"].Visible = false; foreach (DataRow drowDetails in dt.Rows) { dgvVatreturn.Rows.Add(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtInvoiceNo"].Value = drowDetails["Invoice No"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtDate"].Value = drowDetails["Date"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtPartyName"].Value = drowDetails["Party Name"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtMailingName"].Value = drowDetails["Mailing Name"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtsalesmasterid"].Value = drowDetails["SalesMasterId"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtTinNo"].Value = drowDetails["Tin No"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtGrandTotal"].Value = drowDetails["grandtotal"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtTaxName"].Value = drowDetails["taxName"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtTaxableAmount"].Value = drowDetails["rate"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxttax"].Value = drowDetails["taxamount"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtvoucherName"].Value = drowDetails["voucherName"].ToString(); dgvVatreturn.Rows[dgvVatreturn.Rows.Count - 1].Cells["dgvtxtVoucherType"].Value = drowDetails["voucherType"].ToString(); } if (dgvVatreturn.Rows.Count > 0) { SerialNo(); dgvVatreturn.Rows.Add(); CalculateTotal(); } dtblFill.Clear(); } } catch (Exception ex) { MessageBox.Show("VRR:06" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function for fill details in Purchase Return when coming from Register or Report /// </summary> public void FillRegisterOrReport() { try { btnSave.Text = "Update"; btnDelete.Enabled = true; txtReturnNo.ReadOnly = true; VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtblPurchaseReturnMaster = new DataTable(); DataTable dtblPurchaseMasterViewById = new DataTable(); UnitConvertionSP SPUnitConversion = new UnitConvertionSP(); PurchaseReturnMasterSP SPPurchaseReturnMaster = new PurchaseReturnMasterSP(); PurchaseReturnDetailsSP SPPurchaseReturnDetails = new PurchaseReturnDetailsSP(); BatchSP spBatch = new BatchSP(); DataTable dtbl = new DataTable(); decimal decPurchaseReturnDetailsId = 0; decimal decTotalValue = 0; decimal decRegisterTotalAmount = 0; decimal decInvoiceNo = 0; dtblPurchaseReturnMaster = SPPurchaseReturnMaster.PurchaseReturnViewByPurchaseReturnMasterId(decPurchaseReturnMasterId); if (dtblPurchaseReturnMaster.Rows.Count > 0) { txtReturnNo.Text = dtblPurchaseReturnMaster.Rows[0]["invoiceNo"].ToString(); strReturnNo = dtblPurchaseReturnMaster.Rows[0]["invoiceNo"].ToString(); strVoucherNo = dtblPurchaseReturnMaster.Rows[0]["voucherNo"].ToString(); decPurchaseReturnSuffixPrefixId = Convert.ToDecimal(dtblPurchaseReturnMaster.Rows[0]["suffixPrefixId"].ToString()); decPurchaseReturnVoucherTypeId = Convert.ToDecimal(dtblPurchaseReturnMaster.Rows[0]["voucherTypeId"].ToString()); VoucherTypeInfo infoVoucherType = new VoucherTypeInfo(); infoVoucherType = spVoucherType.VoucherTypeView(decPurchaseReturnVoucherTypeId); this.Text = infoVoucherType.VoucherTypeName; isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decPurchaseReturnVoucherTypeId); txtReturnNo.ReadOnly = (isAutomatic) ? true : false; decPurchaseReturnTypeId = decPurchaseReturnVoucherTypeId; dtpDate.Text = dtblPurchaseReturnMaster.Rows[0]["date"].ToString(); cmbCashOrParty.SelectedValue = dtblPurchaseReturnMaster.Rows[0]["ledgerId"].ToString(); cmbPurchaseAccount.SelectedValue = dtblPurchaseReturnMaster.Rows[0]["purchaseAccount"].ToString(); txtTransportationCompany.Text = dtblPurchaseReturnMaster.Rows[0]["transportationCompany"].ToString(); txtNarration.Text = dtblPurchaseReturnMaster.Rows[0]["narration"].ToString(); txtLrlNo.Text = dtblPurchaseReturnMaster.Rows[0]["lrNo"].ToString(); cmbCurrency.SelectedValue = dtblPurchaseReturnMaster.Rows[0]["exchangeRateId"].ToString(); if (dtblPurchaseReturnMaster.Rows[0]["voucherTypeId1"].ToString() != string.Empty) { cmbVoucherType.SelectedValue = dtblPurchaseReturnMaster.Rows[0]["voucherTypeId1"].ToString(); } else { cmbVoucherType.SelectedValue = 0; } cmbInvoiceNo.Text = dtblPurchaseReturnMaster.Rows[0]["invoiceNo1"].ToString(); if (dtblPurchaseReturnMaster.Rows[0]["totalAmount1"].ToString() != string.Empty) { decRegisterTotalAmount = Convert.ToDecimal(dtblPurchaseReturnMaster.Rows[0]["totalAmount"].ToString()); } txtTotalAmount.Text = dtblPurchaseReturnMaster.Rows[0]["totalAmount"].ToString(); if (dtblPurchaseReturnMaster.Rows[0]["PurchaseMasterId"].ToString() != string.Empty && Convert.ToInt32(dtblPurchaseReturnMaster.Rows[0]["PurchaseMasterId"]) != 0) { InvoiceNoComboFillInRegister(); cmbInvoiceNo.SelectedValue = dtblPurchaseReturnMaster.Rows[0]["PurchaseMasterId"]; decInvoiceNo = Convert.ToDecimal(cmbInvoiceNo.SelectedValue.ToString()); dtblPurchaseMasterViewById = SPPurchaseReturnMaster.PurchaseReturnMasterViewByPurchaseMasterId(Convert.ToDecimal(dtblPurchaseReturnMaster.Rows[0]["PurchaseMasterId"].ToString())); } else { cmbInvoiceNo.SelectedValue = dtblPurchaseReturnMaster.Rows[0]["PurchaseMasterId"]; } strInvoiceNo = dtblPurchaseReturnMaster.Rows[0]["invoiceNo1"].ToString(); decimal decDiscnt = Math.Round(Convert.ToDecimal(dtblPurchaseReturnMaster.Rows[0]["discount"].ToString()), PublicVariables._inNoOfDecimalPlaces); dtbl = SPPurchaseReturnDetails.PurchaseReturnDetailsViewByMasterId(decPurchaseReturnMasterId); dgvPurchaseReturn.Rows.Clear(); for (int i = 0; i < dtbl.Rows.Count; i++) { isAmountcalc = false; dgvPurchaseReturn.Rows.Add(); int ini = dgvPurchaseReturn.Rows.Count; decPurchaseReturnDetailsId = Convert.ToDecimal(dtbl.Rows[i]["purchaseReturnDetailsId"].ToString()); dgvPurchaseReturn.Rows[i].Cells["dgvtxtSlNo"].Value = dtbl.Rows[i]["slno"].ToString(); dgvPurchaseReturn.Rows[i].Cells["dgvtxtproductCode"].Value = dtbl.Rows[i]["productCode"].ToString(); dgvPurchaseReturn.Rows[i].Cells["dgvtxtproductName"].Value = dtbl.Rows[i]["productName"].ToString(); dgvPurchaseReturn.Rows[i].Cells["dgvtxtproductId"].Value = dtbl.Rows[i]["productId"].ToString(); decimal decProductId = Convert.ToDecimal(dgvPurchaseReturn.Rows[i].Cells["dgvtxtproductId"].Value.ToString()); dgvPurchaseReturn.Rows[i].Cells["dgvtxtConversionRate"].Value = SPUnitConversion.UnitConversionRateByUnitConversionId(decimal.Parse(dtbl.Rows[i]["unitConversionId"].ToString())); dgvPurchaseReturn.Rows[i].Cells["dgvtxtUnitConversionId"].Value = decimal.Parse(dtbl.Rows[i]["unitConversionId"].ToString()); dgvPurchaseReturn.Rows[i].Cells["dgvtxtqty"].Value = (dtbl.Rows[i]["qty"].ToString() != string.Empty) ? Convert.ToDecimal(dtbl.Rows[i]["qty"].ToString()) : 0; if (dtbl.Rows[i]["unitName"].ToString() != string.Empty) { UnitComboFill(decProductId, dgvPurchaseReturn.Rows[i].Index, dgvPurchaseReturn.Rows[i].Cells["dgvcmbUnit"].ColumnIndex); dgvPurchaseReturn.Rows[i].Cells["dgvcmbUnit"].Value = dtbl.Rows[i]["unitName"].ToString(); } else { dgvPurchaseReturn.Rows[i].Cells["dgvcmbUnit"].Value = "NA"; } dgvPurchaseReturn.Rows[i].Cells["dgvcmbUnit"].ReadOnly = (dtblPurchaseReturnMaster.Rows[0]["voucherTypeId1"].ToString() != string.Empty) ? true : false; if (dtbl.Rows[i]["godownId"].ToString() != string.Empty) { dgvPurchaseReturn.Rows[i].Cells["dgvcmbGodown"].Value = Convert.ToDecimal(dtbl.Rows[i]["godownId"].ToString()); } else { dgvPurchaseReturn.Rows[i].Cells["dgvcmbGodown"].Value = "NA"; } if (dtbl.Rows[i]["rackId"].ToString() != string.Empty) { dgvPurchaseReturn.Rows[i].Cells["dgvCmbRack"].Value = Convert.ToDecimal(dtbl.Rows[i]["rackId"].ToString()); } else { dgvPurchaseReturn.Rows[i].Cells["dgvCmbRack"].Value = "NA"; } if (dtbl.Rows[i]["batchId"].ToString() != string.Empty) { BatchComboFill(decProductId, dgvPurchaseReturn.Rows[i].Index, dgvPurchaseReturn.Rows[i].Cells["dgvcmbBatch"].ColumnIndex); dgvPurchaseReturn.Rows[i].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(dtbl.Rows[i]["batchId"].ToString()); } else { dgvPurchaseReturn.Rows[i].Cells["dgvcmbBatch"].Value = "NA"; } if (dtbl.Rows[i]["taxId"].ToString() != string.Empty && dtbl.Rows[i]["taxId"].ToString() != "NA") { dgvPurchaseReturn.Rows[i].Cells["dgvcmbTax"].Value = Convert.ToDecimal(dtbl.Rows[i]["taxId"].ToString()); } else { dgvPurchaseReturn.Rows[i].Cells["dgvcmbTax"].Value = "NA"; } if (dtblPurchaseReturnMaster.Rows[0]["voucherTypeId1"].ToString() != string.Empty) { dgvPurchaseReturn.Rows[i].Cells["dgvcmbBatch"].ReadOnly = true; } dgvPurchaseReturn.Rows[i].Cells["dgvtxtPurchaseDetailsId"].Value = dtbl.Rows[i]["purchaseDetailsId"].ToString(); dgvPurchaseReturn.Rows[i].Cells["dgvtxtbarcode"].Value = dtbl.Rows[i]["barcode"].ToString(); dgvPurchaseReturn.Rows[i].Cells["dgvtxtPurchaseReturnDetailsId"].Value = decPurchaseReturnDetailsId; decimal decRate = Convert.ToDecimal(dtbl.Rows[i]["rate"].ToString()); dgvPurchaseReturn.Rows[i].Cells["dgvtxtrate"].Value = Math.Round(decRate, PublicVariables._inNoOfDecimalPlaces); decimal decGross = Convert.ToDecimal(dtbl.Rows[i]["grossAmount"].ToString()); dgvPurchaseReturn.Rows[i].Cells["dgvtxtgrossValue"].Value = Math.Round(decGross, PublicVariables._inNoOfDecimalPlaces); decimal decDis = Convert.ToDecimal(dtbl.Rows[i]["discount"].ToString()); dgvPurchaseReturn.Rows[i].Cells["dgvtxtdiscount"].Value = Math.Round(decDis, PublicVariables._inNoOfDecimalPlaces); decimal decNet = Convert.ToDecimal(dtbl.Rows[i]["netAmount"].ToString()); dgvPurchaseReturn.Rows[i].Cells["dgvtxtNetAmount"].Value = Math.Round(decNet, PublicVariables._inNoOfDecimalPlaces); decimal decTax = Convert.ToDecimal(dtbl.Rows[i]["taxAmount"].ToString()); dgvPurchaseReturn.Rows[i].Cells["dgvtxttaxAmount"].Value = Math.Round(decTax, PublicVariables._inNoOfDecimalPlaces); decimal decTotal = Convert.ToDecimal(dtbl.Rows[i]["amount"].ToString()); dgvPurchaseReturn.Rows[i].Cells["dgvtxtAmount"].Value = Math.Round(decTotal, PublicVariables._inNoOfDecimalPlaces); decTotalValue = decTotalValue + Convert.ToDecimal(dtbl.Rows[i]["amount"].ToString()); if (cmbInvoiceNo.Visible == true) { dgvPurchaseReturn.Rows[dgvPurchaseReturn.Rows.Count - 1].ReadOnly = true; } } lblTaxAmount.Text = Math.Round(decimal.Parse(dtblPurchaseReturnMaster.Rows[0]["totalTax"].ToString()), 2).ToString(); ; txtTotalAmount.Text = decTotalValue.ToString(); txtBillDiscount.Text = decDiscnt.ToString(); DGVPurchaseReturnTaxFill(); DGVTaxCombofill(); Calculate(); isAmountcalc = true; } } catch (Exception ex) { MessageBox.Show("PR:55" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call this form from frmVoucherSearch form to view voucher details /// </summary> /// <param name="frm"></param> /// <param name="decId"></param> public void CallFromVoucherSerach(frmVoucherSearch frm, decimal decId) { try { isEditMode = true; decIsEditModeMasterId = decId; base.Show(); SalaryVoucherMasterSP SpMaster = new SalaryVoucherMasterSP(); SalaryVoucherMasterInfo InfoMaster = new SalaryVoucherMasterInfo(); VoucherTypeSP spVoucherType = new VoucherTypeSP(); btnDelete.Enabled = true; btnSave.Text = "Update"; InfoMaster = SpMaster.SalaryVoucherMasterView(decIsEditModeMasterId); strVoucherNoforEdit = InfoMaster.VoucherNo; strVoucherNo = InfoMaster.VoucherNo; txtVoucherNo.Text = InfoMaster.InvoiceNo; strInvoiceNo = InfoMaster.InvoiceNo; txtVoucherDate.Text = InfoMaster.Date.ToString("dd-MMMM-yyyy"); string stra = Convert.ToDateTime(InfoMaster.Month.ToString()).ToString("MMM yyyy"); dtpMonth.Value = Convert.ToDateTime(InfoMaster.Month.ToString("MMM yyyy")); txtNarration.Text = InfoMaster.Narration; lblTotalAmount.Text = InfoMaster.TotalAmount.ToString(); decMonthlySuffixPrefixId = InfoMaster.SuffixPrefixId; decMonthlyVoucherTypeId = InfoMaster.VoucherTypeId; this.objVoucherSearch = frm; cmbCashOrBankAcc.SelectedValue = InfoMaster.LedgerId; isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decMonthlyVoucherTypeId); if (isAutomatic) { txtVoucherNo.Enabled = false; } else { txtVoucherNo.Enabled = true; } dtpMonth.Enabled = false; GridFill(isEditMode); } catch (Exception ex) { MessageBox.Show("MSV2: " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill the details for edit or delete /// </summary> public void FillRegisterOrReport() { SalesQuotationDetailsSP SpSalesQuotationDetails = new SalesQuotationDetailsSP(); TransactionsGeneralFill transactionGeneralFillObj = new TransactionsGeneralFill(); SalesQuotationMasterInfo infoSalesQuotationMaster = new SalesQuotationMasterInfo(); SalesQuotationMasterSP SpSalesQuotationMaster = new SalesQuotationMasterSP(); ProductSP SpProduct = new ProductSP(); try { VoucherTypeSP spVoucherType = new VoucherTypeSP(); IsDoAfterFill = false; IsCellValue = false; btnSave.Text = "Update"; btnDelete.Enabled = true; infoSalesQuotationMaster = SpSalesQuotationMaster.SalesQuotationMasterView(decSalesquotationMasterId); txtQuotationNo.Text = infoSalesQuotationMaster.InvoiceNo; strVoucherNo = infoSalesQuotationMaster.VoucherNo.ToString(); decSalesQuotationPreffixSuffixId = Convert.ToDecimal(infoSalesQuotationMaster.SuffixPrefixId); decSalesQuotationVoucherId = Convert.ToDecimal(infoSalesQuotationMaster.VoucherTypeId); isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decSalesQuotationVoucherId); decsalesQuotationTypeId = decSalesQuotationVoucherId; txtSalesQuotationDate.Text = infoSalesQuotationMaster.Date.ToString("dd-MMM-yyyy"); cmbCashOrParty.SelectedValue = infoSalesQuotationMaster.LedgerId; ComboSalesManFill(); cmbSalesman.SelectedValue = infoSalesQuotationMaster.EmployeeId; txtNarration.Text = infoSalesQuotationMaster.Narration; cmbCurrency.SelectedValue = infoSalesQuotationMaster.ExchangeRateId; decimal decsalesregisterTotal = Convert.ToDecimal(infoSalesQuotationMaster.TotalAmount.ToString()); decsalesregisterTotal = Math.Round(decsalesregisterTotal, PublicVariables._inNoOfDecimalPlaces); txtTotal.Text = Convert.ToString(decsalesregisterTotal); cmbPricinglevel.SelectedValue = infoSalesQuotationMaster.PricinglevelId; DataTable dtbl = new DataTable(); dtbl = SpSalesQuotationDetails.SalesQuotationDetailsViewByMasterId(decSalesquotationMasterId); if (isAutomatic) { txtQuotationNo.ReadOnly = true; txtSalesQuotationDate.Focus(); } else { txtQuotationNo.ReadOnly = false; txtQuotationNo.Focus(); } string strApproved = Convert.ToString(infoSalesQuotationMaster.Approved); if (strApproved == "False") { cbxApproved.Checked = false; } else { cbxApproved.Checked = true; } decimal decCount = SpSalesQuotationMaster.CheckingStastusForSalesQuotation(decSalesquotationMasterId); if (decCount > 0) { cbxApproved.Enabled = false; } else { cbxApproved.Enabled = true; } for (int i = 0; i < dtbl.Rows.Count; i++) { isAmountcalc = false; dgvProduct.Rows.Add(); dgvProduct.Rows[i].HeaderCell.Value = string.Empty; dgvProduct.Rows[i].Cells["dgvtxtQuotationDetailsId"].Value = Convert.ToDecimal(dtbl.Rows[i]["quotationDetailsId"].ToString()); dgvProduct.Rows[i].Cells["ProductId"].Value = dtbl.Rows[i]["productId"].ToString(); dgvProduct.Rows[i].Cells["dgvtxtBarcode"].Value = dtbl.Rows[i]["Barcode"].ToString(); dgvProduct.Rows[i].Cells["dgvtxtProductCode"].Value = dtbl.Rows[i]["productCode"].ToString(); transactionGeneralFillObj.UnitViewAllByProductId(dgvProduct, dtbl.Rows[i]["productId"].ToString(), i); SpSalesQuotationMaster.SalesQuotationMasterBatchFill(dgvProduct, Convert.ToDecimal(dtbl.Rows[i]["productId"].ToString()), i); dgvProduct.Rows[i].Cells["dgvtxtProductName"].Value = dtbl.Rows[i]["productName"].ToString(); dgvProduct.Rows[i].Cells["dgvtxtQty"].Value = dtbl.Rows[i]["qty"].ToString(); IsCellValue = true; dgvProduct.Rows[i].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(dtbl.Rows[i]["unitId"].ToString()); IsCellValue = false; dgvProduct.Rows[i].Cells["dgvtxtRate"].Value = dtbl.Rows[i]["rate"].ToString(); IsCellValue = true; dgvProduct.Rows[i].Cells["dgvtxtAmount"].Value = dtbl.Rows[i]["amount"].ToString(); IsCellValue = false; dgvProduct.Rows[i].Cells["dgvcmbbatch"].Value = Convert.ToDecimal(dtbl.Rows[i]["batchId"].ToString()); UnitConvertionSP SpUnitConvertion = new UnitConvertionSP(); DataTable dtblUnitByProduct = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(dgvProduct.Rows[i].Cells["ProductId"].Value.ToString()); if (dtblUnitByProduct.Rows.Count > 0) { foreach (DataRow drUnitByProduct in dtblUnitByProduct.Rows) { if (dgvProduct.Rows[i].Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString()) { dgvProduct.Rows[i].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[2].ToString()); dgvProduct.Rows[i].Cells["dgvtxtConversionRate"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[3].ToString()); } } } decimal decStandardRate = SpProduct.SalesInvoiceProductRateForSales(Convert.ToDecimal(dtbl.Rows[i]["productId"].ToString()), PublicVariables._dtCurrentDate, Convert.ToDecimal(dtbl.Rows[i]["batchId"].ToString()), Convert.ToDecimal(cmbPricinglevel.SelectedValue), PublicVariables._inNoOfDecimalPlaces); if (dgvProduct.Rows[i].Cells["dgvtxtConversionRate"].Value != null && dgvProduct.Rows[i].Cells["dgvtxtConversionRate"].Value.ToString() != string.Empty) { if (decStandardRate != 0 && Convert.ToDecimal(dgvProduct.Rows[i].Cells["dgvtxtConversionRate"].Value) != 0) { dgvProduct.Rows[i].Cells["dgvtxtRate"].Value = Math.Round(decStandardRate / Convert.ToDecimal(dgvProduct.Rows[i].Cells["dgvtxtConversionRate"].Value), PublicVariables._inNoOfDecimalPlaces); } } } isAmountcalc = true; IsCellValue = true; IsDoAfterFill = true; } catch (Exception ex) { MessageBox.Show("SQ:39" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill controls for updation /// </summary> public void FillFunction() { try { SalaryVoucherMasterSP SpMaster = new SalaryVoucherMasterSP(); SalaryVoucherMasterInfo InfoMaster = new SalaryVoucherMasterInfo(); VoucherTypeSP spVoucherType = new VoucherTypeSP(); InfoMaster = SpMaster.SalaryVoucherMasterView(decIsEditModeMasterId); strVoucherNoforEdit = InfoMaster.VoucherNo; strVoucherNo = InfoMaster.VoucherNo; txtVoucherNo.Text = InfoMaster.InvoiceNo; strInvoiceNo = InfoMaster.InvoiceNo; txtVoucherDate.Text = InfoMaster.Date.ToString("dd-MMMM-yyyy"); string stra = Convert.ToDateTime(InfoMaster.Month.ToString()).ToString("MMM yyyy"); dtpMonth.Value = Convert.ToDateTime(InfoMaster.Month.ToString("MMM yyyy")); txtNarration.Text = InfoMaster.Narration; decimal decTotalAmont = Math.Round(Convert.ToDecimal(InfoMaster.TotalAmount.ToString()), PublicVariables._inNoOfDecimalPlaces); lblTotalAmount.Text = decTotalAmont.ToString(); decMonthlySuffixPrefixId = InfoMaster.SuffixPrefixId; decMonthlyVoucherTypeId = InfoMaster.VoucherTypeId; cmbCashOrBankAcc.SelectedValue = InfoMaster.LedgerId; isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decMonthlyVoucherTypeId); if (isAutomatic) { txtVoucherNo.Enabled = false; } else { txtVoucherNo.Enabled = true; } dtpMonth.Enabled = false; GridFill(isEditMode); } catch (Exception ex) { MessageBox.Show("MSV10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call this form from VoucherType Selection form /// </summary> /// <param name="decVoucherTypeId"></param> /// <param name="strVoucherTypeName"></param> public void CallFromVoucherTypeSelection(decimal decVoucherTypeId, string strVoucherTypeName) { try { decsalesQuotationTypeId = decVoucherTypeId; VoucherTypeSP SPVoucherType = new VoucherTypeSP(); isAutomatic = SPVoucherType.CheckMethodOfVoucherNumbering(decsalesQuotationTypeId); SuffixPrefixSP SPSuffixPrefix = new SuffixPrefixSP(); SuffixPrefixInfo InfoSuffixPrefix = new SuffixPrefixInfo(); InfoSuffixPrefix = SPSuffixPrefix.GetSuffixPrefixDetails(decsalesQuotationTypeId, dtpSalesQuotationDate.Value); decSalesQuotationPreffixSuffixId = InfoSuffixPrefix.SuffixprefixId; this.Text = strVoucherTypeName; base.Show(); if (isAutomatic) { txtSalesQuotationDate.Focus(); } } catch (Exception ex) { MessageBox.Show("SQ:14" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call this form from VoucherType Selection form /// </summary> public void CallFromVoucherTypeSelection(decimal decStockJournalVoucherTypeId, string strSockJournalVocherTypeName)//used for vouchertype selection while open the form { try { decVoucherTypeId = decStockJournalVoucherTypeId; VoucherTypeSP spVoucherType = new VoucherTypeSP(); isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decStockJournalVoucherTypeId); SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(decStockJournalVoucherTypeId, dtpDate.Value); decSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; this.Text = strSockJournalVocherTypeName; base.Show(); if (isAutomatic) { txtDate.Focus(); } else { txtVoucherNo.Focus(); } } catch (Exception ex) { MessageBox.Show("SJ:24" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Adding columns to print /// </summary> /// <param name="decDeliveryNoteMasterId"></param> public void PrintForDotMatrix(decimal decDeliveryNoteMasterId) { try { DataTable dtblOtherDetails = new DataTable(); CompanySP spComapany = new CompanySP(); dtblOtherDetails = spComapany.CompanyViewForDotMatrix(); //-------------Grid Details-------------------\\ DataTable dtblGridDetails = new DataTable(); dtblGridDetails.Columns.Add("SlNo"); dtblGridDetails.Columns.Add("BarCode"); dtblGridDetails.Columns.Add("ProductCode"); dtblGridDetails.Columns.Add("ProductName"); dtblGridDetails.Columns.Add("Qty"); dtblGridDetails.Columns.Add("Unit"); dtblGridDetails.Columns.Add("Godown"); dtblGridDetails.Columns.Add("Rack"); dtblGridDetails.Columns.Add("Batch"); dtblGridDetails.Columns.Add("Rate"); dtblGridDetails.Columns.Add("Amount"); int inRowCount = 0; foreach (DataGridViewRow dRow in dgvProduct.Rows) { if (!dRow.IsNewRow) { DataRow dr = dtblGridDetails.NewRow(); dr["SlNo"] = ++inRowCount; if (dRow.Cells["dgvtxtBarcode"].Value != null) { dr["BarCode"] = dRow.Cells["dgvtxtBarcode"].Value.ToString(); } if (dRow.Cells["dgvtxtProductCode"].Value != null) { dr["ProductCode"] = dRow.Cells["dgvtxtProductCode"].Value.ToString(); } if (dRow.Cells["dgvtxtProductName"].Value != null) { dr["ProductName"] = dRow.Cells["dgvtxtProductName"].Value.ToString(); } if (dRow.Cells["dgvtxtQty"].Value != null) { dr["Qty"] = dRow.Cells["dgvtxtQty"].Value.ToString(); } if (dRow.Cells["dgvcmbUnit"].Value != null) { dr["Unit"] = dRow.Cells["dgvcmbUnit"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbGodown"].Value != null) { dr["Godown"] = dRow.Cells["dgvcmbGodown"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbRack"].Value != null) { dr["Rack"] = dRow.Cells["dgvcmbRack"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbBatch"].Value != null) { dr["Batch"] = dRow.Cells["dgvcmbBatch"].FormattedValue.ToString(); } if (dRow.Cells["dgvtxtRate"].Value != null) { dr["Rate"] = dRow.Cells["dgvtxtRate"].Value.ToString(); } if (dRow.Cells["dgvtxtAmount"].Value != null) { dr["Amount"] = dRow.Cells["dgvtxtAmount"].Value.ToString(); } dtblGridDetails.Rows.Add(dr); } } //-------------Other Details-------------------\\ dtblOtherDetails.Columns.Add("voucherNo"); dtblOtherDetails.Columns.Add("date"); dtblOtherDetails.Columns.Add("ledgerName"); dtblOtherDetails.Columns.Add("Narration"); dtblOtherDetails.Columns.Add("Currency"); dtblOtherDetails.Columns.Add("TotalAmount"); dtblOtherDetails.Columns.Add("DeliveryMode"); dtblOtherDetails.Columns.Add("PricingLevel"); dtblOtherDetails.Columns.Add("Type"); dtblOtherDetails.Columns.Add("SalesMan"); dtblOtherDetails.Columns.Add("CustomerAddress"); dtblOtherDetails.Columns.Add("CustomerTIN"); dtblOtherDetails.Columns.Add("CustomerCST"); dtblOtherDetails.Columns.Add("AmountInWords"); dtblOtherDetails.Columns.Add("Declaration"); dtblOtherDetails.Columns.Add("Heading1"); dtblOtherDetails.Columns.Add("Heading2"); dtblOtherDetails.Columns.Add("Heading3"); dtblOtherDetails.Columns.Add("Heading4"); DataRow dRowOther = dtblOtherDetails.Rows[0]; dRowOther["voucherNo"] = txtDeliveryNoteNo.Text; dRowOther["date"] = txtDate.Text; dRowOther["ledgerName"] = cmbCashOrParty.Text; dRowOther["Narration"] = txtNarration.Text; dRowOther["Currency"] = cmbCurrency.Text; dRowOther["TotalAmount"] = txtTotalAmnt.Text; dRowOther["DeliveryMode"] = cmbDeliveryMode.Text; dRowOther["PricingLevel"] = cmbPricingLevel.Text; dRowOther["Type"] = cmbType.Text; dRowOther["SalesMan"] = cmbSalesMan.Text; dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", ""); AccountLedgerSP spAccountLedger = new AccountLedgerSP(); AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo(); infoAccountLedger = spAccountLedger.AccountLedgerView(Convert.ToDecimal(cmbCashOrParty.SelectedValue)); dRowOther["CustomerAddress"] = (infoAccountLedger.Address.ToString().Replace("\n", ", ")).Replace("\r", ""); dRowOther["CustomerTIN"] = infoAccountLedger.Tin; dRowOther["CustomerCST"] = infoAccountLedger.Cst; dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtTotalAmnt.Text), PublicVariables._decCurrencyId); VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtblDeclaration = spVoucherType.DeclarationAndHeadingGetByVoucherTypeId(decDeliveryNoteVoucherTypeId); dRowOther["Declaration"] = dtblDeclaration.Rows[0]["Declaration"].ToString(); dRowOther["Heading1"] = dtblDeclaration.Rows[0]["Heading1"].ToString(); dRowOther["Heading2"] = dtblDeclaration.Rows[0]["Heading2"].ToString(); dRowOther["Heading3"] = dtblDeclaration.Rows[0]["Heading3"].ToString(); dRowOther["Heading4"] = dtblDeclaration.Rows[0]["Heading4"].ToString(); int inFormId = spVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString())); PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails); } catch (Exception ex) { MessageBox.Show("DN41:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }