/// <summary>
 /// Adding columns to print
 /// </summary>
 /// <param name="decDeliveryNoteMasterId"></param>
 public void PrintForDotMatrix(decimal decDeliveryNoteMasterId)
 {
     try
     {
         DataTable dtblOtherDetails = new DataTable();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         dtblOtherDetails = bllCompanyCreation.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", "");
         AccountLedgerBll bllAccountLedger = new AccountLedgerBll();
         AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo();
         infoAccountLedger = bllAccountLedger.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);
         VoucherTypeBll BllVoucherType = new VoucherTypeBll();
         DataTable dtblDeclaration = BllVoucherType.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 = BllVoucherType.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);
     }
 }
 public void PrintForDotMatrix(decimal decServiceMasterId)
 {
     try
     {
         DataTable dtblOtherDetails = new DataTable();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         dtblOtherDetails = bllCompanyCreation.CompanyViewForDotMatrix();
         //-------------Grid Details-------------------\\
         DataTable dtblGridDetails = new DataTable();
         dtblGridDetails.Columns.Add("SlNo");
         dtblGridDetails.Columns.Add("Particulars");
         dtblGridDetails.Columns.Add("Measure");
         dtblGridDetails.Columns.Add("Amount");
         int inRowCount = 0;
         foreach (DataGridViewRow dRow in dgvServiceVoucher.Rows)
         {
             if (dRow.HeaderCell.Value != null && dRow.HeaderCell.Value.ToString() != "X")
             {
                 if (!dRow.IsNewRow)
                 {
                     DataRow dr = dtblGridDetails.NewRow();
                     dr["SlNo"] = ++inRowCount;
                     dr["Particulars"] = dRow.Cells["dgvcmbParticulars"].FormattedValue.ToString();
                     dr["Amount"] = dRow.Cells["dgvtxtAmount"].Value.ToString();
                     dr["Measure"] = dRow.Cells["dgvtxtMeasure"].FormattedValue.ToString();
                     dtblGridDetails.Rows.Add(dr);
                 }
             }
         }
         //-------------Other Details-------------------\\
         dtblOtherDetails.Columns.Add("InvoiceNo");
         dtblOtherDetails.Columns.Add("date");
         dtblOtherDetails.Columns.Add("CashOrParty");
         dtblOtherDetails.Columns.Add("CreditPeriod");
         dtblOtherDetails.Columns.Add("Currency");
         dtblOtherDetails.Columns.Add("SalesMan");
         dtblOtherDetails.Columns.Add("CustomerName");
         dtblOtherDetails.Columns.Add("totalAmount");
         dtblOtherDetails.Columns.Add("DiscountAmount");
         dtblOtherDetails.Columns.Add("GrandTotal");
         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["InvoiceNo"] = txtInvoiceNumber.Text;
         dRowOther["date"] = txtVoucherDate.Text;
         dRowOther["CashOrParty"] = cmbCashParty.Text;
         dRowOther["CreditPeriod"] = txtCreditPeriod.Text;
         dRowOther["Currency"] = cmbCurrency.Text;
         dRowOther["SalesMan"] = cmbSalesman.Text;
         dRowOther["CustomerName"] = txtCustomer.Text;
         dRowOther["totalAmount"] = txtTotalAmount.Text;
         dRowOther["DiscountAmount"] = txtDiscount.Text;
         dRowOther["GrandTotal"] = txtGrandTotal.Text;
         dRowOther["Narration"] = txtNarration.Text;
         dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", "");
         dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtGrandTotal.Text), PublicVariables._decCurrencyId);
         VoucherTypeBll BllVoucherType = new VoucherTypeBll();
         DataTable dtblDeclaration = BllVoucherType.DeclarationAndHeadingGetByVoucherTypeId(DecServicetVoucherTypeId);
         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 = BllVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString()));
         PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails);
     }
     catch (Exception ex)
     {
         MessageBox.Show("SV 26 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Print function for Dotmatrix Printer
 /// </summary>
 /// <param name="decMasterId"></param>
 public void PrintForDotMatrix(decimal decMasterId)
 {
     try
     {
         DataTable dtblOtherDetails = new DataTable();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         dtblOtherDetails = bllCompanyCreation.CompanyViewForDotMatrix();
         DataTable dtblGridDetails = new DataTable();
         dtblGridDetails.Columns.Add("SlNo");
         dtblGridDetails.Columns.Add("BankAccount");
         dtblGridDetails.Columns.Add("ChequeNo");
         dtblGridDetails.Columns.Add("ChequeDate");
         dtblGridDetails.Columns.Add("Amount");
         DataRow dr = dtblGridDetails.NewRow();
         dr["SlNo"] = 1;
         dr["ChequeNo"] = txtcheckNo.Text;
         dr["BankAccount"] = cmbBank.Text;
         dr["ChequeDate"] = txtCheckDate.Text;
         dr["Amount"] = txtAmount.Text;
         dtblGridDetails.Rows.Add(dr);
         dtblOtherDetails.Columns.Add("voucherNo");
         dtblOtherDetails.Columns.Add("date");
         dtblOtherDetails.Columns.Add("ledgerName");
         dtblOtherDetails.Columns.Add("Narration");
         dtblOtherDetails.Columns.Add("TotalAmount");
         dtblOtherDetails.Columns.Add("AmountInWords");
         dtblOtherDetails.Columns.Add("Declaration");
         dtblOtherDetails.Columns.Add("Heading1");
         dtblOtherDetails.Columns.Add("Heading2");
         dtblOtherDetails.Columns.Add("Heading3");
         dtblOtherDetails.Columns.Add("Heading4");
         dtblOtherDetails.Columns.Add("CustomerAddress");
         DataRow dRowOther = dtblOtherDetails.Rows[0];
         dRowOther["voucherNo"] = txtVoucherNo.Text;
         dRowOther["date"] = txtVoucherDate.Text;
         dRowOther["ledgerName"] = cmbAccountLedger.Text;
         dRowOther["Narration"] = txtNarration.Text;
         dRowOther["TotalAmount"] = txtAmount.Text;
         dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", "");
         AccountLedgerBll bllAccountLedger = new AccountLedgerBll();
         AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo();
         infoAccountLedger = bllAccountLedger.AccountLedgerView(Convert.ToDecimal(cmbAccountLedger.SelectedValue));
         dRowOther["CustomerAddress"] = (infoAccountLedger.Address.ToString().Replace("\n", ", ")).Replace("\r", "");
         string s = new NumToText().AmountWords(Convert.ToDecimal(txtAmount.Text), PublicVariables._decCurrencyId);
         dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtAmount.Text), PublicVariables._decCurrencyId);
         VoucherTypeBll BllVOucherType = new VoucherTypeBll();
         DataTable dtblDeclaration = BllVOucherType.DeclarationAndHeadingGetByVoucherTypeId(decPDCReceivableVoucherTypeId);
         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 = BllVOucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString()));
         PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails);
     }
     catch (Exception ex)
     {
         MessageBox.Show("PR22:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Print function for dotmatrix printer
 /// </summary>
 /// <param name="decContraMasterId"></param>
 public void PrintForDotMatrix(decimal decContraMasterId)
 {
     try
     {
         DataTable dtblOtherDetails = new DataTable();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         dtblOtherDetails = bllCompanyCreation.CompanyViewForDotMatrix();
         //-------------Grid Details-------------------\\
         DataTable dtblGridDetails = new DataTable();
         dtblGridDetails.Columns.Add("SlNo");
         dtblGridDetails.Columns.Add("CashOrBankGrid");
         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 dgvContraVoucher.Rows)
         {
             if (!dRow.IsNewRow)
             {
                 DataRow dr = dtblGridDetails.NewRow();
                 dr["SlNo"] = ++inRowCount;
                 dr["CashOrBankGrid"] = dRow.Cells["dgvcmbBankorCashAccount"].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);
             }
         }
         //-------------Other Details-------------------\\
         dtblOtherDetails.Columns.Add("voucherNo");
         dtblOtherDetails.Columns.Add("date");
         dtblOtherDetails.Columns.Add("totalAmount");
         dtblOtherDetails.Columns.Add("CashOrBank");
         dtblOtherDetails.Columns.Add("Narration");
         dtblOtherDetails.Columns.Add("Type");
         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"] = txtContraVoucherDate.Text;
         dRowOther["totalAmount"] = txtTotal.Text;
         dRowOther["CashOrBank"] = cmbBankAccount.Text;
         dRowOther["Narration"] = txtNarration.Text;
         dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", "");
         if (rbtnDeposit.Checked)
         {
             dRowOther["Type"] = "Deposit";
         }
         else
         {
             dRowOther["Type"] = "Withdraw";
         }
         dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtTotal.Text), PublicVariables._decCurrencyId);
         VoucherTypeBll BllVoucherType = new VoucherTypeBll();
         DataTable dtblDeclaration = BllVoucherType.DeclarationAndHeadingGetByVoucherTypeId(DecContraVoucherTypeId);
         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 = BllVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString()));
         PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails);
     }
     catch (Exception ex)
     {
         MessageBox.Show("CV:27" + 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();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         dtblOtherDetails = bllCompanyCreation.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", "");
         AccountLedgerBll bllAccountLedger = new AccountLedgerBll();
         AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo();
         infoAccountLedger = bllAccountLedger.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);
         VoucherTypeBll BllVoucherType = new VoucherTypeBll();
         DataTable dtblDeclaration = BllVoucherType.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 = BllVoucherType.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>
 /// print function for dotmatrix printer
 /// </summary>
 /// <param name="decPhysicalStockMasterId"></param>
 public void PrintForDotMatrix(decimal decPhysicalStockMasterId)
 {
     try
     {
         DataTable dtblOtherDetails = new DataTable();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         dtblOtherDetails = bllCompanyCreation.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("Rack");
         dtblGridDetails.Columns.Add("Batch");
         dtblGridDetails.Columns.Add("Rate");
         dtblGridDetails.Columns.Add("Amount");
         int inRowCount = 0;
         foreach (DataGridViewRow dRow in dgvPhysicalStock.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);
             }
         }
         dtblOtherDetails.Columns.Add("voucherNo");
         dtblOtherDetails.Columns.Add("date");
         dtblOtherDetails.Columns.Add("Narration");
         dtblOtherDetails.Columns.Add("TotalAmount");
         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["Narration"] = txtNarration.Text;
         dRowOther["TotalAmount"] = txtTotalAmount.Text;
         dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", "");
         dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtTotalAmount.Text), PublicVariables._decCurrencyId);
         VoucherTypeBll BllVoucherType = new VoucherTypeBll();
         DataTable dtblDeclaration = BllVoucherType.DeclarationAndHeadingGetByVoucherTypeId(decPhysicalStockVoucherTypeId);
         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 = BllVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString()));
         PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails);
     }
     catch (Exception ex)
     {
         MessageBox.Show("PS:3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to print the voucher in dotmatrix
 /// </summary>
 /// <param name="decMasterId"></param>
 public void PrintForDotMatrix(decimal decMasterId)
 {
     try
     {
         DataTable dtblOtherDetails = new DataTable();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         dtblOtherDetails = bllCompanyCreation.CompanyViewForDotMatrix();
         //-------------Grid Details-------------------\\
         DataTable dtblGridDetails = new DataTable();
         dtblGridDetails.Columns.Add("SlNo");
         dtblGridDetails.Columns.Add("Account Ledger");
         dtblGridDetails.Columns.Add("CrOrDr");
         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 dgvJournalVoucher.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["CrOrDr"] = dRow.Cells["dgvcmbDrOrCr"].Value.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);
                 }
             }
         }
         //-------------Other Details-------------------\\
         dtblOtherDetails.Columns.Add("voucherNo");
         dtblOtherDetails.Columns.Add("date");
         dtblOtherDetails.Columns.Add("DebitTotal");
         dtblOtherDetails.Columns.Add("CreditTotal");
         dtblOtherDetails.Columns.Add("Narration");
         dtblOtherDetails.Columns.Add("DebitAmountInWords");
         dtblOtherDetails.Columns.Add("CreditAmountInWords");
         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["DebitTotal"] = txtDebitTotal.Text;
         dRowOther["CreditTotal"] = txtCreditTotal.Text;
         dRowOther["Narration"] = txtNarration.Text;
         dRowOther["DebitAmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtDebitTotal.Text), PublicVariables._decCurrencyId);
         dRowOther["CreditAmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtCreditTotal.Text), PublicVariables._decCurrencyId);
         dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", "");
         VoucherTypeBll BllVoucherType = new VoucherTypeBll();
         DataTable dtblDeclaration = BllVoucherType.DeclarationAndHeadingGetByVoucherTypeId(decJournalVoucherTypeId);
         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 = BllVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString()));
         PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails);
     }
     catch (Exception ex)
     {
         MessageBox.Show("JV28:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }