/// <summary>
 /// Function to fill the Dates
 /// </summary>
 public void FinancialYearDate()
 {
     try
     {
         dtpFromDate.MinDate = PublicVariables._dtFromDate;
         dtpFromDate.MaxDate = PublicVariables._dtToDate;
         CompanyInfo infoComapany = new CompanyInfo();
         //CompanySP spCompany = new CompanySP();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         infoComapany = bllCompanyCreation.CompanyView(1);
         DateTime dtFromDate = infoComapany.CurrentDate;
         dtpFromDate.Value = dtFromDate;
         txtFromDate.Text = dtFromDate.ToString("dd-MMM-yyyy");
         dtpFromDate.Value = Convert.ToDateTime(txtFromDate.Text);
         dtpToDate.MinDate = PublicVariables._dtFromDate;
         dtpToDate.MaxDate = PublicVariables._dtToDate;
         infoComapany = bllCompanyCreation.CompanyView(1);
         DateTime dtToDate = infoComapany.CurrentDate;
         dtpToDate.Value = dtToDate;
         dtpToDate.Text = dtToDate.ToString("dd-MMM-yyyy");
         dtpToDate.Value = Convert.ToDateTime(txtFromDate.Text);
     }
     catch (Exception ex)
     {
         MessageBox.Show("JREG4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void CompanyGridFill()
 {
     try
     {
         List<DataTable> listObj = new List<DataTable>();
         //CompanySP spComapny = new CompanySP();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         listObj = bllCompanyCreation.CompanyViewAllForSelectCompany();
         dgvSelectCompany.DataSource = listObj[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("SELCMPNY : 1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to do after company creation
 /// </summary>
 public void AfterCompanyCreation()
 {
     try
     {
         PublicVariables._decCurrentUserId = 1;
         formMDI.MDIObj.CallFromLogin();
         formMDI.MDIObj.ShowQuickLaunchMenu();
         frmNewFinancialYear frmNewFinancialYearObj = new frmNewFinancialYear();
         frmNewFinancialYearObj.MdiParent = formMDI.MDIObj;
         frmNewFinancialYearObj.CallFromCompanyCreation(this);
         CompanyInfo infoCompany = new CompanyInfo();
         CompanyCreationBll BllCompanyCreation = new CompanyCreationBll();
         infoCompany = BllCompanyCreation.CompanyView(1);
         PublicVariables._decCurrencyId = infoCompany.CurrencyId;
     }
     catch (Exception ex)
     {
         MessageBox.Show("CR11:" + 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>
 /// 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);
     }
 }
 /// <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>
 /// On 'Print' button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvContraReport.RowCount > 0)
         {
             DataSet ds = new DataSet();
             //CompanySP spCompany = new CompanySP();
             CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
             frmReport reportobj = new frmReport();
             //ContraMasterSP spContraMaster = new ContraMasterSP();
             ContraVoucherDetailsBll bllContraVoucherDetails = new ContraVoucherDetailsBll();
             List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1);
             List<DataTable> listObjCotraReport = bllContraVoucherDetails.ContraReport(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), cmbVoucherType.Text, cmbCashOrBank.Text, strType);
             ds.Tables.Add(listObjCompany[0]);
             ds.Tables.Add(listObjCotraReport[0]);
             reportobj.MdiParent = formMDI.MDIObj;
             reportobj.ContraVoucherReport(ds);
         }
         else
         {
             MessageBox.Show("No data found", "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("CRT:12" + ex.Message, "Open Miracle", 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>
 /// On 'Print' button click to print
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvDailySalary.RowCount > 0)
         {
             DataSet ds = new DataSet();
             //CompanySP spCompany = new CompanySP();
             CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
             EmployeeCreationBll BllEmployeeCreation = new EmployeeCreationBll();
             List<DataTable> listEmployee = BllEmployeeCreation.EmployeeViewAllForDailySalaryReport(cmbEmployeeCode.Text, cmbDesignation.Text, Convert.ToDateTime(dtpFromDate.Text.ToString()), Convert.ToDateTime(dtpToDate.Text.ToString()), cmbStatus.Text);
             List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1);
             ds.Tables.Add(listObjCompany[0]);
             ds.Tables.Add(listEmployee[0]);
             frmReport frmReportObj = new frmReport();
             frmReportObj.MdiParent = formMDI.MDIObj;
             frmReportObj.DailySalaryReport(ds);
         }
         else
         {
             Messages.InformationMessage("No data found");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("DSR9 " + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function for Save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         CompanyInfo infoCompany = new CompanyInfo();
         CompanyCreationBll BllCompanyCreation = new CompanyCreationBll();
         CompanyPathInfo infoCompanyPath = new CompanyPathInfo();
         CompanyPathBll BllCompanyPath = new CompanyPathBll();
         UserInfo infoUser = new UserInfo();
         UserBll bllUser = new UserBll();
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         //ExchangeRateBll BllExchangeRate = new ExchangeRateBll();
         infoCompany.CompanyName = txtCompanyName.Text.Trim();
         infoCompany.MailingName = txtMailingName.Text.Trim();
         infoCompany.Address = txtAddress.Text.Trim();
         infoCompany.Phone = txtPhoneNo.Text.Trim();
         infoCompany.Mobile = txtMobile.Text.Trim();
         infoCompany.EmailId = txtEmail.Text.Trim();
         infoCompany.Web = txtWeb.Text.Trim();
         infoCompany.Country = txtCountry.Text.Trim();
         infoCompany.State = txtState.Text.Trim();
         infoCompany.Pin = txtPincode.Text.Trim();
         infoCompany.CurrencyId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         decCurrencyIdForStatus = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoCompany.FinancialYearFrom = Convert.ToDateTime(txtFinancialYearFrom.Text.Trim().ToString());
         infoCompany.BooksBeginingFrom = Convert.ToDateTime(txtBooksBegining.Text.Trim().ToString());
         infoCompany.Tin = txtTinNo.Text.Trim();
         infoCompany.Cst = txtCstNo.Text.Trim();
         infoCompany.Pan = txtPanNo.Text.Trim();
         infoCompany.CurrentDate = DateTime.Now;
         infoCompany.Logo = logo;
         infoCompany.Extra1 = string.Empty;
         infoCompany.Extra2 = string.Empty;
         infoCompanyPath.CompanyName = txtCompanyName.Text.Trim();
         infoCompanyPath.IsDefault = cbxSetAsDefault.Checked;
         infoCompanyPath.Extra1 = string.Empty;
         infoCompanyPath.Extra2 = string.Empty;
         infoUser.UserName = txtAdminUserName.Text.Trim();
         infoUser.Password = txtPassword.Text.Trim();
         infoUser.Active = true;
         infoUser.Extra1 = string.Empty;
         infoUser.Extra2 = string.Empty;
         infoUser.Narration = string.Empty;
         infoUser.RoleId = 1;
         if (BllCompanyCreation.CompanyCheckExistence(txtCompanyName.Text.Trim().ToString(), 0) == false)
         {
             decimal decCompanyId = BllCompanyCreation.CompanyAddParticularFeilds(infoCompany);
             PublicVariables._decCurrentCompanyId = decCompanyId;
             infoCompanyPath.CompanyPath = Application.StartupPath + "\\Data\\" + PublicVariables._decCurrentCompanyId;
             BllCompanyPath.CompanyPathAdd(infoCompanyPath);
             if (formMDI.demoProject || CreateCompany())
             {
                 if (!formMDI.demoProject)
                 {
                     infoCompanyPath.CompanyPath = strPath;
                 }
                 else
                 {
                     infoCompanyPath.CompanyPath = Application.StartupPath + "\\Data";
                     PublicVariables._decCurrentCompanyId = 0;
                 }
                 CompanyInfo infoNewCompany = new CompanyInfo();
                 CompanyPathInfo infoNewCompanyPath = new CompanyPathInfo();
                 UserInfo infoNewUser = new UserInfo();
                 UserBll bllNewUser = new UserBll();
                 ExchangeRateInfo infoNewExchangeRate = new ExchangeRateInfo();
                 ExchangeRateBll BllExchangeRate = new ExchangeRateBll();
                 CompanyPathBll BllNewCompanyPath = new CompanyPathBll();
                 infoNewCompany = infoCompany;
                 infoNewCompanyPath = infoCompanyPath;
                 infoNewUser = infoUser;
                 decCompanyId = BllCompanyCreation.CompanyAddParticularFeilds(infoNewCompany);
                 bllNewUser.UserAdd(infoNewUser);
                 BllNewCompanyPath.CompanyPathAdd(infoNewCompanyPath);
                 Messages.SavedMessage();
                 formMDI.MDIObj.MenuStripEnabling();
                 //  To set default currencyId.............//
                 infoNewExchangeRate.CurrencyId = infoNewCompany.CurrencyId;
                 infoNewExchangeRate.Rate = 1;
                 infoNewExchangeRate.Narration = string.Empty;
                 infoNewExchangeRate.Extra1 = string.Empty;
                 infoNewExchangeRate.Extra2 = string.Empty;
                 infoNewExchangeRate.ExtraDate = System.DateTime.Now;
                 infoNewExchangeRate.Date = System.DateTime.Now;
                 BllExchangeRate.ExchangeRateAdd(infoNewExchangeRate);
                 CurrencyBll BllCurrency = new CurrencyBll();
                 BllCurrency.DefaultCurrencySet(decCurrencyIdForStatus);
                 AfterCompanyCreation();
                 Clear();
                 this.Close();
             }
             else
             {
                 Messages.InformationMessage("Company creation failed");
             }
         }
         else
         {
             Messages.InformationMessage("Companyname already exist");
             txtCompanyName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("CR1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function for Edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         CompanyInfo infoCompany = new CompanyInfo();
         CompanyCreationBll BllCompanyCreation = new CompanyCreationBll();
         CompanyPathInfo infoCompanyPath = new CompanyPathInfo();
         CompanyPathBll BllCompanyPath = new CompanyPathBll();
         UserInfo infoUser = new UserInfo();
         UserBll bllUser = new UserBll();
         infoCompany.CompanyName = txtCompanyName.Text.Trim();
         infoCompany.MailingName = txtMailingName.Text.Trim();
         infoCompany.Address = txtAddress.Text.Trim();
         infoCompany.Phone = txtPhoneNo.Text.Trim();
         infoCompany.Mobile = txtMobile.Text.Trim();
         infoCompany.EmailId = txtEmail.Text.Trim();
         infoCompany.Web = txtWeb.Text.Trim();
         infoCompany.Country = txtCountry.Text.Trim();
         infoCompany.State = txtState.Text.Trim();
         infoCompany.Pin = txtPincode.Text.Trim();
         infoCompany.CurrencyId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoCompany.FinancialYearFrom = Convert.ToDateTime(txtFinancialYearFrom.Text.Trim().ToString());
         infoCompany.BooksBeginingFrom = Convert.ToDateTime(txtBooksBegining.Text.Trim().ToString());
         infoCompany.Tin = txtTinNo.Text.Trim();
         infoCompany.Cst = txtCstNo.Text.Trim();
         infoCompany.Pan = txtPanNo.Text.Trim();
         infoCompany.CurrentDate = DateTime.Now;
         infoCompany.Logo = logo;
         infoCompany.Extra1 = string.Empty;
         infoCompany.Extra2 = string.Empty;
         infoCompanyPath.CompanyName = txtCompanyName.Text.Trim();
         infoCompanyPath.IsDefault = cbxSetAsDefault.Checked;
         strPath = Application.StartupPath + "\\Data\\" + PublicVariables._decCurrentCompanyId;
         infoCompanyPath.CompanyPath = strPath;
         infoCompanyPath.Extra1 = string.Empty;
         infoCompanyPath.Extra2 = string.Empty;
         infoCompanyPath.ExtraDate = DateTime.Now;
         infoCompanyPath.CompanyId = 1;
         infoCompany.CompanyId = 1;
         BllCompanyCreation.CompanyEdit(infoCompany);
         BllCompanyPath.CompanyPathEdit(infoCompanyPath);
         Messages.UpdatedMessage();
         //  To set default currencyId...........In exchangeRate..//
         ExchangeRateBll BllExchangeRate = new ExchangeRateBll();
         ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo();
         infoExchangeRate.ExchangeRateId = 1;
         infoExchangeRate.Date = PublicVariables._dtCurrentDate;
         infoExchangeRate.CurrencyId = infoCompany.CurrencyId;
         infoExchangeRate.ExtraDate = PublicVariables._dtCurrentDate;
         infoExchangeRate.Narration = string.Empty;
         infoExchangeRate.Rate = 1;
         infoExchangeRate.Extra1 = string.Empty;
         infoExchangeRate.Extra2 = string.Empty;
         BllExchangeRate.ExchangeRateEdit(infoExchangeRate);
         FinancialYearInfo infoFinancialYear = new FinancialYearInfo();
         FinancialYearBll BllFinancialYear = new FinancialYearBll();
         decimal decIdentity;
         infoFinancialYear.FromDate = PublicVariables._dtFromDate;
         infoFinancialYear.ToDate = PublicVariables._dtToDate;
         infoFinancialYear.ExtraDate = DateTime.Now;
         infoFinancialYear.Extra1 = string.Empty;
         infoFinancialYear.Extra2 = string.Empty;
         bool isExist = BllFinancialYear.FinancialYearExistenceCheck(PublicVariables._dtFromDate, PublicVariables._dtToDate);
         if (!isExist)
         {
             decIdentity = BllFinancialYear.FinancialYearAddWithReturnIdentity(infoFinancialYear);
         }
         //===========Add companyDetails in ExternalDb =====================//
         decimal decCompanyIdForTemp = PublicVariables._decCurrentCompanyId;
         PublicVariables._decCurrentCompanyId = 0;
         CompanyCreationBll bllExCompanyCreation = new CompanyCreationBll();
         CompanyPathBll bllExCompanyPath = new CompanyPathBll();
         CompanyInfo infoExCompany = new CompanyInfo();
         CompanyPathInfo infoExCompanyPath = new CompanyPathInfo();
         infoExCompany = infoCompany;
         infoExCompanyPath = infoCompanyPath;
         infoExCompany.CompanyId = decCompanyIdForTemp;
         infoExCompanyPath.CompanyId = decCompanyIdForTemp;
         bllExCompanyCreation.CompanyEdit(infoExCompany);
         bllExCompanyPath.CompanyPathEdit(infoExCompanyPath);
         PublicVariables._decCurrentCompanyId = decCompanyIdForTemp;
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show("CR2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to delete a company
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         decimal decCompanyIdForTemp = PublicVariables._decCurrentCompanyId;
         CompanyCreationBll BllCompanyCreation = new CompanyCreationBll();
         PublicVariables._decCurrentCompanyId = 0;
         CompanyCreationBll bllExCompanyCreation = new CompanyCreationBll();
         CompanyPathBll bllExCompanyPath = new CompanyPathBll();
         bllExCompanyCreation.CompanyDelete(decCompanyIdForTemp);
         bllExCompanyPath.CompanyPathDelete(decCompanyIdForTemp);
         Messages.DeletedMessage();
         Application.Restart();
     }
     catch (Exception ex)
     {
         MessageBox.Show("CR12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill controls for Update
 /// </summary>
 public void CompanyViewForEdit()
 {
     try
     {
         isEditMode = true;
         this.Text = "Edit Company";
         btnSave.Text = "Update";
         btnDelete.Enabled = true;
         gbxDetails.Visible = false;
         txtAdminUserName.ReadOnly = true;
         txtAdminUserName.BackColor = Color.White;
         cmbCurrency.Enabled = false;
         CompanyCreationBll BllCompanyCreation = new CompanyCreationBll();
         CompanyInfo infoCompany = new CompanyInfo();
         decimal decCompanyId = 1;
         infoCompany = BllCompanyCreation.CompanyView(PublicVariables._decCurrentCompanyId);
         txtCompanyName.Text = infoCompany.CompanyName;
         txtMailingName.Text = infoCompany.MailingName;
         txtAddress.Text = infoCompany.Address;
         txtPhoneNo.Text = infoCompany.Phone;
         txtMobile.Text = infoCompany.Mobile;
         txtEmail.Text = infoCompany.EmailId;
         txtWeb.Text = infoCompany.Web;
         txtCountry.Text = infoCompany.Country;
         txtState.Text = infoCompany.State;
         txtPincode.Text = infoCompany.Pin;
         cmbCurrency.SelectedValue = infoCompany.CurrencyId;
         txtFinancialYearFrom.Text = infoCompany.FinancialYearFrom.ToString("dd-MMM-yyyy");
         dtpFinancialYearFrom.Text = infoCompany.FinancialYearFrom.ToString();
         txtBooksBegining.Text = infoCompany.BooksBeginingFrom.ToString("dd-MMM-yyyy");
         dtpBooksBegining.Text = infoCompany.BooksBeginingFrom.ToString();
         txtTinNo.Text = infoCompany.Tin;
         txtCstNo.Text = infoCompany.Cst;
         txtPanNo.Text = infoCompany.Pan;
         logo = (byte[])infoCompany.Logo;
         MemoryStream ms = new MemoryStream(logo);
         Image newimage = Image.FromStream(ms);
         pbxLogo.Image = newimage;
         pbxLogo.SizeMode = PictureBoxSizeMode.StretchImage;
         CompanyPathInfo infoCompanyPath = new CompanyPathInfo();
         CompanyPathBll BllComapnyPath = new CompanyPathBll();
         infoCompanyPath = BllComapnyPath.CompanyPathView(1);
         if (infoCompanyPath.IsDefault == true)
         {
             cbxSetAsDefault.Checked = true;
         }
         else
         {
             cbxSetAsDefault.Checked = false;
         }
         UserBll bllUser = new UserBll();
         UserInfo infoUser = new UserInfo();
         decimal decuserId = PublicVariables._decCurrentUserId;
         infoUser = bllUser.UserView(decuserId);
         txtAdminUserName.Text = infoUser.UserName;
         txtPassword.Text = infoUser.Password;
         txtRetypePassword.Text = infoUser.Password;
     }
     catch (Exception ex)
     {
         MessageBox.Show("CR8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// On 'Print' button click to take print
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvAdvancePayment.Rows.Count > 0)
         {
             DataSet ds = new DataSet();
             //CompanySP spCompany = new CompanySP();
             CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
             List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1);
             ds.Tables.Add(listObjCompany[0]);
             AdvancePaymentBll bllAdvancePayment = new AdvancePaymentBll();
             List<DataTable> listObj = new List<DataTable>();
             listObj = bllAdvancePayment.AdvancePaymentViewAllForAdvancePaymentReport(dtpFrmDate.Value, dtpToDate.Value, cmbEmployeeCode.Text, DateTime.Parse(dtpSalaryMonth.Text.ToString()));
             ds.Tables.Add(listObj[0]);
             frmReport frmReportObj = new frmReport();
             frmReportObj.MdiParent = formMDI.MDIObj;
             frmReportObj.AdvancePaymentReportPrinting(ds);
         }
         else
         {
             Messages.InformationMessage("No data found");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("APR:8" + ex.Message, "Open Miracle", 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
     {
         DataSet dsSalesOrderReport = new DataSet();
        // CompanySP spCompany = new CompanySP();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1);
         DataTable dtblDetails = new DataTable();
         dtblDetails = ListObj[0].Copy();
         if (ListObj[0].Rows.Count > 0)
         {
             dsSalesOrderReport.Tables.Add(listObjCompany[0]);
             dsSalesOrderReport.Tables.Add(dtblDetails);
             frmReport frmReport = new frmReport();
             frmReport.MdiParent = formMDI.MDIObj;
             frmReport.SalesOrderReportPrinting(dsSalesOrderReport, txtTotalAmount.Text);
         }
         else
         {
             Messages.InformationMessage("No data found");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SORP16:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 16
0
 /// <summary>
 /// Form Load
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void formMDI_Load(object sender, EventArgs e)
 {
     try
     {
         CheckNewVersionComesOfOpenMiracle();
         MDIObj = this;
         MenuStripDisabling();
         companyToolStripMenuItem.Enabled = true;
         editCompanyToolStripMenuItem1.Enabled = false;
         BackUpToolStripMenuItem.Enabled = false;
         RestoreToolStripMenuItem.Enabled = false;
         dateToolStripMenuItem.Enabled = false;
         exitToolStripMenuItem.Enabled = true;
         createCompanyToolStripMenuItem.Enabled = true;
         SelectCompanyToolStripMenuItem.Enabled = true;
         logoutToolStripMenuItem.Enabled = false;
         logoutToolStripMenuItem.Enabled = false;
         //CompanySP spCompany = new CompanySP();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         decimal decCompanyCount = bllCompanyCreation.CompanyCount();
         if (decCompanyCount != -1)
         {
             if (decCompanyCount == 1)
             {
                 PublicVariables._decCurrentCompanyId = bllCompanyCreation.CompanyGetIdIfSingleCompany();
                 CurrentDate();
                 frmLogin frmLoginObj = new frmLogin();
                 frmLoginObj.MdiParent = MDIObj;
                 frmLoginObj.CallFromFormMdi(this);
             }
             else if (decCompanyCount < 1)
             {
                 CurrentDateBefore();
                 frmCompanyCreation frmCompanyCreationObj = new frmCompanyCreation();
                 frmCompanyCreationObj.MdiParent = formMDI.MDIObj;
                 frmCompanyCreationObj.CallFromFormMdi();
                 SelectCompanyToolStripMenuItem.Enabled = false;
             }
             else
             {
                 PublicVariables._decCurrentCompanyId = 0;
                 //CompanyPathSP spCompanyPath = new CompanyPathSP();
                 CompanyPathBll bllCompanyPath = new CompanyPathBll();
                 decimal decDefaultCompanyId = bllCompanyPath.CompanyViewForDefaultCompany();
                 if (decDefaultCompanyId > 0)
                 {
                     PublicVariables._decCurrentCompanyId = decDefaultCompanyId;
                     CurrentDate();
                     frmLogin frmLoginObj = new frmLogin();
                     frmLoginObj.MdiParent = formMDI.MDIObj;
                     frmLoginObj.CallFromFormMdi(this);
                 }
                 else
                 {
                     CurrentDate();
                     frmSelectCompany frmSelectCompanyObj = new frmSelectCompany();
                     frmSelectCompanyObj.MdiParent = formMDI.MDIObj;
                     frmSelectCompanyObj.CallFromMdi();
                 }
             }
             CurrentSettings();
         }
         else
         {
             createCompanyToolStripMenuItem.Enabled = false;
             SelectCompanyToolStripMenuItem.Enabled = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MDI 40 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 17
0
 /// <summary>
 /// Disables the menus and Logouts company
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void logoutToolStripMenuItem_Click_1(object sender, EventArgs e)
 {
     try
     {
         List<Form> openForms = new List<Form>();
         foreach (Form f in Application.OpenForms)
             openForms.Add(f);
         foreach (Form f in openForms)
         {
             if (f.Name != "formMDI")
                 f.Close();
         }
         MDIObj = this;
         PublicVariables._decCurrentCompanyId = 0;
         MenuStripDisabling();
         companyToolStripMenuItem.Enabled = true;
         editCompanyToolStripMenuItem1.Enabled = false;
         BackUpToolStripMenuItem.Enabled = false;
         RestoreToolStripMenuItem.Enabled = false;
         dateToolStripMenuItem.Enabled = false;
         exitToolStripMenuItem.Enabled = true;
         createCompanyToolStripMenuItem.Enabled = true;
         SelectCompanyToolStripMenuItem.Enabled = true;
         logoutToolStripMenuItem.Enabled = false;
         formMDI.MDIObj.Text = "OpenMiracle";
         //CompanySP spCompany = new CompanySP();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         decimal decCompanyCount = bllCompanyCreation.CompanyCount();
         if (decCompanyCount == 1)
         {
             PublicVariables._decCurrentCompanyId = bllCompanyCreation.CompanyGetIdIfSingleCompany();
             CurrentDate();
             frmLogin frmLoginObj = new frmLogin();
             frmLoginObj.MdiParent = MDIObj;
             frmLoginObj.CallFromFormMdi(this);
         }
         else if (decCompanyCount < 1)
         {
             CurrentDateBefore();
             frmCompanyCreation frmCompanyCreationObj = new frmCompanyCreation();
             frmCompanyCreationObj.MdiParent = formMDI.MDIObj;
             frmCompanyCreationObj.CallFromFormMdi();
         }
         else
         {
             PublicVariables._decCurrentCompanyId = 0;
             //CompanyPathSP spCompanyPath = new CompanyPathSP();
             CompanyPathBll bllCompanyPath = new CompanyPathBll();
             decimal decDefaultCompanyId = bllCompanyPath.CompanyViewForDefaultCompany();
             if (decDefaultCompanyId > 0)
             {
                 PublicVariables._decCurrentCompanyId = decDefaultCompanyId;
                 CurrentDate();
                 frmLogin frmLoginObj = new frmLogin();
                 frmLoginObj.MdiParent = formMDI.MDIObj;
                 frmLoginObj.CallFromFormMdi(this);
             }
             else
             {
                 CurrentDate();
                 frmSelectCompany frmSelectCompanyObj = new frmSelectCompany();
                 frmSelectCompanyObj.MdiParent = formMDI.MDIObj;
                 frmSelectCompanyObj.CallFromMdi();
             }
         }
         CurrentSettings();
     }
     catch (Exception ex)
     {
         MessageBox.Show("MDI 214: " + 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
     {
         if (dgvPriceList.Rows.Count > 0)
         {
             frmReport frmReport = new frmReport();
             frmReport.MdiParent = formMDI.MDIObj;
             DataTable dtblOption = new DataTable();
             dtblOption.Columns.Add("PurchaseRate", typeof(String));
             dtblOption.Columns.Add("SalesRate", typeof(String));
             dtblOption.Columns.Add("LastSalesRate", typeof(String));
             dtblOption.Columns.Add("StandardRate", typeof(String));
             dtblOption.Columns.Add("MRP", typeof(String));
             dtblOption.Columns.Add("Price", typeof(String));
             DataRow dr = dtblOption.NewRow();
             dr["PurchaseRate"] = cbxPurchaseRate.Checked ? "True" : "False";
             dr["SalesRate"] = cbxSalesRate.Checked ? "True" : "False";
             dr["LastSalesRate"] = cbxlastSalesRate.Checked ? "True" : "False";
             dr["StandardRate"] = CbxStandardRate.Checked ? "True" : "False";
             dr["MRP"] = cbxMrp.Checked ? "True" : "False";
             dr["Price"] = "True";
             dtblOption.Rows.Add(dr);
             DataSet ds = new DataSet();
             CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
             List<DataTable> listObjPriceList = BllPriceList.PriceListReportPrint(decGroupId, strProductName, decSizeId, decModelId, decPricingLevelId);
             List<DataTable> listObjCompanyReport = bllCompanyCreation.CompanyViewDataTable(1);
             DataTable dtblPriceListGridFill = listObjPriceListReport[0].Copy();
             ds.Tables.Add(listObjCompanyReport[0]);
             ds.Tables.Add(listObjPriceList[0]);
             ds.Tables.Add(dtblOption);
             frmReport.MdiParent = formMDI.MDIObj;
             frmReport.PriceListReportPrinting(ds);
         }
         else
         {
             Messages.InformationMessage("No data found");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(" RPL17:" + 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);
     }
 }
Esempio n. 20
0
        //, string credit, string debit, string closing)
        public void ExportExcel(DataGridView dgv, string rptName, int inFirstRow, int inFirstCol, string Format, object dtFromDate, object dtToDate, string header)
        {
            try
            {
                if (CheckWhetherOfficeInstalled())
                {
                    int inColN = 1;
                    Cursor.Current = Cursors.WaitCursor;
                    string strName = "", strAddress = "", strPhone = "";

                    Excel.Range range = null;
                    Excel.Application excel = new Excel.Application();

                    Excel.Workbook wb = excel.Workbooks.Add(Excel.XlSheetType.xlWorksheet);
                    Excel.Worksheet ws = (Excel.Worksheet)excel.ActiveSheet;

                    //CompanySP spCompany = new CompanySP();
                    CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
                    List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1);
                    //BranchInfo InfoBranch = new BranchInfo();
                    //BranchSP SpBranch = new BranchSP();
                    // InfoBranch = SpBranch.BranchView(PublicVariables._branchId);
                    strAddress = listObjCompany[0].Rows[0].ItemArray[3].ToString().Replace("\r\n", " ");
                    strPhone = listObjCompany[0].Rows[0].ItemArray[4].ToString();
                    strName = listObjCompany[0].Rows[0].ItemArray[1].ToString();

                    //BranchInfo InfoBranch = new BranchInfo();
                    //BranchSP SpBranch = new BranchSP();
                    //InfoBranch = SpBranch.BranchView(PublicVariables._branchId);
                    //strAddress = InfoBranch.Address.Replace("\r\n", " ");
                    //if (InfoBranch.PhoneNo == "")
                    //{
                    //    strPhone = InfoBranch.Mobile;
                    //}
                    //else
                    //{
                    //    strPhone = InfoBranch.PhoneNo;
                    //}
                    //strName = InfoBranch.BranchName;

                    //**************Report Header ***************************************
                    //range = (Excel.Range)ws.Cells[1, 1];
                    range = ws.get_Range("A1", "I1");
                    range.MergeCells = true;
                    range.Font.Size = 15;
                    range.RowHeight = 27;
                    range.Interior.Color = ColorTranslator.ToWin32(Color.LightGray);
                    range.Cells.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;
                    range.Cells.VerticalAlignment = Excel.XlVAlign.xlVAlignCenter;
                    range.Value2 = strName;

                    range = ws.get_Range("A2", "I2");
                    range.MergeCells = true;
                    range.Font.Size = 10;

                    range.Cells.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;
                    range.Value2 = strAddress;

                    range = ws.get_Range("A3", "I3");
                    range.MergeCells = true;
                    range.Font.Size = 10;

                    range.Cells.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;
                    range.Value2 = "Phone No :" + strPhone;

                    range = ws.get_Range("A5", "G5");
                    range.MergeCells = true;
                    range.Font.Size = 11;
                    range.Value2 = rptName;
                    range.Font.Underline = true;
                    range.Font.Bold = true;
                    range.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;

                    range = ws.get_Range("A6", "G6");
                    range.MergeCells = true;
                    //range.Cells.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;
                    range.Font.Size = 11;
                    if (dtFromDate != null && dtToDate != null)
                    {
                        range.Value2 = "(" + DateTime.Parse(dtFromDate.ToString()).Date.ToString("dd-MMM-yyyy") + "  To  " + DateTime.Parse(dtToDate.ToString()).Date.ToString("dd-MMM-yyyy") + ")";
                    }
                    else if (dtFromDate != null)
                    {
                        range.Value2 = DateTime.Parse(dtFromDate.ToString()).Date.ToString("dd-MMM-yyyy");
                    }
                    range.Cells.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;
                    range.MergeCells = true;
                    range.Font.Bold = true;

                    range = ws.get_Range("H5", "H5");
                    range.Value2 = "Date :";
                    range.Font.Bold = true;

                    range = ws.get_Range("I5", "I5");
                    range.Value2 = PublicVariables._dtCurrentDate.Date.ToString("dd-MMM-yyyy");
                    range.Font.Bold = true;

                    int inNewRow = 0;
                    inNewRow = inFirstRow;

                    for (int inRow = inFirstRow; inRow < dgv.Rows.Count; inRow++)
                    {
                        if (dgv.Rows[inRow].Visible != false)
                        {
                            for (int inCol = inFirstCol; inCol < dgv.Columns.Count; inCol++)
                            {
                                if (inRow == 0)
                                {
                                    if (dgv.Columns[inCol].Visible == true)
                                    {
                                        range = (Excel.Range)ws.Cells[inNewRow + 8, inColN];
                                        range.Font.Bold = true;
                                        range.Interior.Color = ColorTranslator.ToWin32(Color.LightGray);
                                        range.Value2 = dgv.Columns[inCol].HeaderText;
                                    }
                                }
                                range = (Excel.Range)ws.Cells[inNewRow + 9, inColN];

                                if (dgv[inCol, inRow].Style.Font != null)
                                {
                                    if (dgv[inCol, inRow].Style.Font.Bold)
                                    {
                                        range.Font.Bold = true;
                                    }
                                }
                                if (dgv.Rows[inRow].DefaultCellStyle.BackColor == Color.LightSkyBlue)
                                {
                                    range.Font.Bold = true;
                                    range.Interior.Color = ColorTranslator.ToWin32(Color.LightGray);

                                }
                                if (dgv.Rows[inRow].DefaultCellStyle.ForeColor == Color.Red)
                                {
                                    range.Font.Bold = true;
                                    range.Interior.Color = ColorTranslator.ToWin32(Color.LightGray);

                                }

                                //if (dgv.Rows[inRow].Visible != false)
                                //{
                                if (dgv.Columns[inCol].Visible == true)
                                {

                                    range.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlHairline, Excel.XlColorIndex.xlColorIndexAutomatic, 1);
                                    if (dgv[inCol, inRow].Value != null)
                                    {
                                        string str = dgv[inCol, inRow].Value.ToString();

                                        try
                                        {
                                            if (dgv.Columns[inCol].HeaderText.Replace(" ", "").ToLower() == "phoneno" || dgv.Columns[inCol].HeaderText.Replace(" ", "").ToLower() == "phonenumber")
                                                range.NumberFormat = "@";
                                            else
                                            {
                                                decimal.Parse(str);
                                                decimal dc = Math.Round(decimal.Parse(str), 2);
                                                str = dc.ToString();
                                                if (dgv.Columns[inCol].Name.ToLower() == "debit" || dgv.Columns[inCol].Name.ToLower() == "credit")
                                                    range.NumberFormat = "#00.00#";
                                                else
                                                    range.NumberFormat = "General";
                                            }
                                        }
                                        catch (Exception)
                                        {
                                            try
                                            {
                                                DateTime.Parse(str);
                                                range.NumberFormat = "dd-MMM-yyyy";
                                                range.NumberFormat = "General";
                                            }
                                            catch (Exception)
                                            {
                                                range.NumberFormat = "@";
                                            }
                                        }
                                        if (str.Contains("Dr") || str.Contains("Cr"))

                                            range.HorizontalAlignment = Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignRight;

                                        //try
                                        //{
                                        //    if (dgv.Columns[inCol].HeaderText.Replace(" ", "").ToLower() == "phoneno" || dgv.Columns[inCol].HeaderText.Replace(" ", "").ToLower() == "phonenumber")
                                        //        range.NumberFormat = "@";
                                        //    else
                                        //    {
                                        //        decimal.Parse(str);
                                        //        decimal dc = Math.Round(decimal.Parse(str), 2);
                                        //        str = dc.ToString();
                                        //    }
                                        //}
                                        //catch (Exception)
                                        //{
                                        //    try
                                        //    {
                                        //        DateTime.Parse(str);
                                        //        range.NumberFormat = "dd-MMM-yyyy";
                                        //        range.NumberFormat = "General";
                                        //    }
                                        //    catch (Exception)
                                        //    {
                                        //        //range.NumberFormat = "@";
                                        //        range.NumberFormat = "General";
                                        //    }
                                        //}
                                        //------------------------------------
                                        //------------------------------------
                                        range.Value2 = str;// dgv[inCol, inRow].Value;

                                    }
                                    inColN++;
                                }
                                //}
                            }
                            inColN = 1;
                            inNewRow++;
                        }
                    }
                    inNewRow = inNewRow + 10;

                    ws.Columns.AutoFit();

                    if (Format == "Excel")
                    {
                        excel.Visible = true;
                    }
                    //else if (Format == "Html")
                    //{
                    //    //***********Deleting all format*************
                    //    ws.Columns.AutoFit();
                    //    FileInfo infoHtml = new FileInfo(Application.StartupPath + "\\Report.html");
                    //    if (infoHtml.Exists)
                    //    {
                    //        infoHtml.Delete();
                    //    }
                    //    //*******************************************

                    //    ws.SaveAs(Application.StartupPath + "\\Report.html", Excel.XlFileFormat.xlHtml, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value);
                    //    excel.Quit();
                    //    System.Diagnostics.Process.Start("IExplore.exe", Application.StartupPath + "\\Report.html");
                    //}
                    Cursor.Current = Cursors.Default;
                }
                else
                {
                    MessageBox.Show("Install office", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(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
     {
         if (dgvDailyAttendanceReport.RowCount > 0)
         {
             DataSet ds = new DataSet();
             //CompanySP spCompany = new CompanySP();
             CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
             List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1);
             ds.Tables.Add(listObjCompany[0]);
             AttendanceBll BllAttendanceMaster = new AttendanceBll();
            List<DataTable> ListAttendance = BllAttendanceMaster.DailyAttendanceViewForDailyAttendanceReport(dtpDate.Text.Trim(), cmbStatus.Text.Trim(), cmbEmployee.Text.Trim(), cmbDesignation.Text.Trim());
            ds.Tables.Add(ListAttendance[0]);
             frmReport frmReportObj = new frmReport();
             frmReportObj.MdiParent = formMDI.MDIObj;
             frmReportObj.DailyAttendanceReportPrinting(ds);
         }
         else
         {
             Messages.InformationMessage("No data found");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("DAR:8" + ex.Message, "Open Miracle", 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);
     }
 }
        /// <summary>
        /// These function is used to reset the form and clear its controlls
        /// </summary>
        public void Clear()
        {
            try
            {

                if (isAutomatic)
                {
                    VoucherNumberGeneration();
                    txtContraVoucherDate.Focus();
                }
                else
                {
                    txtVoucherNo.Text = string.Empty;
                    txtVoucherNo.ReadOnly = false;
                }
                BankOrCashComboFill(cmbBankAccount);
                GridBankOrCashComboFill();
                isEditMode = false;
                dtpContraVoucherDate.MinDate = PublicVariables._dtFromDate;
                dtpContraVoucherDate.MaxDate = PublicVariables._dtToDate;
                CompanyInfo infoComapany = new CompanyInfo();
                //CompanySP spCompany = new CompanySP();
                CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
                infoComapany = bllCompanyCreation.CompanyView(1);
                DateTime dtVoucherDate = infoComapany.CurrentDate;
                dtpContraVoucherDate.Value = dtVoucherDate;
                txtContraVoucherDate.Text = dtVoucherDate.ToString("dd-MMM-yyyy");
                dtpContraVoucherDate.Value = Convert.ToDateTime(txtContraVoucherDate.Text);
                txtContraVoucherDate.Focus();
                txtContraVoucherDate.SelectAll();
                if (txtVoucherNo.ReadOnly)
                {
                    txtContraVoucherDate.Focus();
                }
                else
                {
                    txtVoucherNo.Focus();
                }
                cmbBankAccount.SelectedIndex = -1;
                txtNarration.Text = string.Empty;
                txtTotal.Text = string.Empty;
                dgvContraVoucher.ClearSelection();
                rbtnDeposit.Checked = true;
                btnDelete.Enabled = false;
                btnSave.Text = "Save";
                dgvContraVoucher.Rows.Clear();
                if (frmContraRegisterObj != null)
                {
                    frmContraRegisterObj.Close();
                }
                if (frmContraReportObj != null)
                {
                    frmContraReportObj.Close();
                }
                SettingsBll BllSettings = new SettingsBll();

                if (BllSettings.SettingsStatusCheck("TickPrintAfterSave") == "Yes")
                {
                    cbxPrintafterSave.Checked = true;
                }
                else
                {
                    cbxPrintafterSave.Checked = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("CV:09" + 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
     {
         if (dgvBonusDeductionReport.RowCount > 0)
         {
             DataSet ds = new DataSet();
             //CompanySP spCompany = new CompanySP();
             CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
             List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1);
             ds.Tables.Add(listObjCompany[0]);
             BonusDeductionBll BllBonusDeduction = new BonusDeductionBll();
             List<DataTable> listBonusDeduction = BllBonusDeduction.BonusDeductionReportGridFill(dtpFromDate.Text, dtpToDate.Text, dtpSalaryMonth.Text, cmbDesignation.Text, cmbEmployee.Text, strBonusOrDeduction);
             ds.Tables.Add(listBonusDeduction[0]);
             frmReport frmReportObj = new frmReport();
             frmReportObj.MdiParent = formMDI.MDIObj;
             frmReportObj.BonusDeductionReportPrinting(ds);
         }
         else
         {
             Messages.InformationMessage("No data found");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("BDR:8" + ex.Message, "Open Miracle", 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);
     }
 }
Esempio n. 26
0
 /// <summary>
 /// Function to get the count of created companies
 /// </summary>
 public void CompanyCount()
 {
     try
     {
         //CompanySP spCompany = new CompanySP();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         decimal decCount = bllCompanyCreation.CompanyCount();
         if (decCount > 0)
         {
             SelectCompanyToolStripMenuItem.Enabled = true;
         }
         else
         {
             SelectCompanyToolStripMenuItem.Enabled = false;
         }
         SelectCompanyToolStripMenuItem.Enabled = true;
         createCompanyToolStripMenuItem.Enabled = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("MDI 5: " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// On 'Print' button click to print
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvPayHead.RowCount > 0)
         {
             DataSet ds = new DataSet();
             PayHeadBll BllPayHead = new PayHeadBll();
             List<DataTable> listObj = BllPayHead.PayHeadViewAllForPayHeadReport(cmbPayHead.Text, cmbType.Text);
             //CompanySP spCompany = new CompanySP();
             CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
             List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1);
             frmReport frmreport = new frmReport();
             frmreport.MdiParent = formMDI.MDIObj;
             ds.Tables.Add(listObj[0]);
             ds.Tables.Add(listObjCompany[0]);
             frmreport.PayHeadReport(ds);
         }
         else
         {
             Messages.InformationMessage("No data found");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PHR:7 " + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 28
0
 /// <summary>
 /// Function to get the current Date
 /// </summary>
 public void CurrentDate()
 {
     try
     {
         CompanyInfo infoComapany = new CompanyInfo();
         //CompanySP spCompany = new CompanySP();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         FinancialYearInfo infoFinancialYear = new FinancialYearInfo();
         FinancialYearBll bllFinancialYear = new FinancialYearBll();
         infoComapany = bllCompanyCreation.CompanyView(1);
         PublicVariables._dtCurrentDate = infoComapany.CurrentDate;
         infoFinancialYear = bllFinancialYear.FinancialYearView(1);
         PublicVariables._dtFromDate = infoFinancialYear.FromDate;
         PublicVariables._dtToDate = infoFinancialYear.ToDate;
         dateToolStripMenuItem.Text = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy");
     }
     catch (Exception ex)
     {
         MessageBox.Show("MDI 2 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to set the voucherdate
 /// </summary>
 public void VoucherDate()
 {
     try
     {
         dtpVoucherDate.MinDate = PublicVariables._dtFromDate;
         dtpVoucherDate.MaxDate = PublicVariables._dtToDate;
         CompanyInfo infoComapany = new CompanyInfo();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         infoComapany = bllCompanyCreation.CompanyView(1);
         DateTime dtVoucherDate = infoComapany.CurrentDate;
         dtpVoucherDate.Value = dtVoucherDate;
         txtVoucherDate.Text = dtVoucherDate.ToString("dd-MMM-yyyy");
         dtpVoucherDate.Value = Convert.ToDateTime(txtVoucherDate.Text);
         txtVoucherDate.Focus();
         txtVoucherDate.SelectAll();
     }
     catch (Exception ex)
     {
         MessageBox.Show("SV 05 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Esempio n. 30
0
 /// <summary>
 /// Function to check the Date
 /// </summary>
 public void CurrentDateBefore()
 {
     try
     {
         CompanyInfo infoComapany = new CompanyInfo();
         //CompanySP spCompany = new CompanySP();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         DateTime sysDate = System.DateTime.Today;
         PublicVariables._dtCurrentDate = sysDate;
         DateTime date = new DateTime(sysDate.Year, 04, 01);
         DateTime dtFromDate = new DateTime();
         DateTime dtToDate = new DateTime();
         if (sysDate < date)
         {
             dtFromDate = new DateTime(sysDate.Year - 1, 04, 01);
             dtToDate = new DateTime(sysDate.Year, 03, 31);
         }
         else
         {
             dtFromDate = new DateTime(sysDate.Year, 04, 01);
             dtToDate = new DateTime(sysDate.Year + 1, 03, 31);
         }
         PublicVariables._dtFromDate = dtFromDate;
         PublicVariables._dtToDate = dtToDate;
     }
     catch (Exception ex)
     {
         MessageBox.Show("MDI 1 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }