/// <summary> /// Function to check the Date /// </summary> public void CurrentDateBefore() { try { CompanyInfo infoComapany = new CompanyInfo(); CompanySP spCompany = new CompanySP(); 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); } }
/// <summary> /// On 'Print' button click to print the data /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvPurchaseReturnReport.Rows.Count > 0) { if (dgvPurchaseReturnReport.Rows.Count > 0) { DataSet dsPurchaseReturnReport = new DataSet(); CompanySP spCompany = new CompanySP(); DataTable dtblGrid = dtblReg.Copy(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); dsPurchaseReturnReport.Tables.Add(dtblGrid); dsPurchaseReturnReport.Tables.Add(dtblCompany); frmReport frmReport = new frmReport(); frmReport.MdiParent = formMDI.MDIObj; frmReport.PurchaseReturnReportPrinting(dsPurchaseReturnReport, txtTotalAmount.Text); } } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { formMDI.infoError.ErrorString = "PRRT13:" + ex.Message; } }
/// <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(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); DailyAttendanceMasterSP spDailyAttendanceMaster = new DailyAttendanceMasterSP(); DataTable dtblAttendance = spDailyAttendanceMaster.DailyAttendanceViewForDailyAttendanceReport(dtpDate.Text.Trim(), cmbStatus.Text.Trim(), cmbEmployee.Text.Trim(), cmbDesignation.Text.Trim()); ds.Tables.Add(dtblAttendance); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.DailyAttendanceReportPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { formMDI.infoError.ErrorString = "DAR:8" + ex.Message; } }
/// <summary> /// Function to fill dates /// </summary> public void FinancialYearDate() { try { dtpfromDate.MinDate = PublicVariables._dtFromDate; dtpfromDate.MaxDate = PublicVariables._dtToDate; CompanyInfo infoComapany = new CompanyInfo(); CompanySP spCompany = new CompanySP(); infoComapany = spCompany.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 = spCompany.CompanyView(1); DateTime dtToDate = infoComapany.CurrentDate; dtpTodate.Value = dtToDate; txtTodate.Text = dtToDate.ToString("dd-MMM-yyyy"); dtpTodate.Value = Convert.ToDateTime(txtFromDate.Text); } catch (Exception ex) { MessageBox.Show("PPREG2:" + 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(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); DataTable dtblBonusDeduction = spBonusDeduction.BonusDeductionReportGridFill(dtpFromDate.Text, dtpToDate.Text, dtpSalaryMonth.Text, cmbDesignation.Text, cmbEmployee.Text, strBonusOrDeduction); ds.Tables.Add(dtblBonusDeduction); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.BonusDeductionReportPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { formMDI.infoError.ErrorString = "BDR:8" + ex.Message; } }
/// <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(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); DataTable dtblDetails = new DataTable(); dtblDetails = dtblSalesOrderReport.Copy(); if (dtblSalesOrderReport.Rows.Count > 0) { dsSalesOrderReport.Tables.Add(dtblCompany); 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) { formMDI.infoError.ErrorString = "SORP16:" + ex.Message; } }
/// <summary> /// Print button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click_1(object sender, EventArgs e) { try { PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP(); if (dgvPhysicalStockReport.RowCount > 0) { DataSet ds = new DataSet(); CompanySP spCompany = new CompanySP(); frmReport reportobj = new frmReport(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); DataTable dtblPhysicalStockReport = spPhysicalStockMaster.PhysicalStockReportFill(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), txtVoucherNo.Text.Trim(), txtProductName.Text.Trim(), Convert.ToDecimal(cmbProductCode.SelectedValue), Convert.ToDecimal(cmbVoucherType.SelectedValue)); ds.Tables.Add(dtblCompany); ds.Tables.Add(dtblPhysicalStockReport); reportobj.MdiParent = formMDI.MDIObj; reportobj.PhysicalStockReport(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { formMDI.infoError.ErrorString = "PSRT6:" + ex.Message; } }
/// <summary> /// On print button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { DateTime FromDate = this.dtpFromDate.Value; DateTime ToDate = this.dtpToDate.Value; DataSet ds = new DataSet(); CompanySP spcompany = new CompanySP(); DataTable dtblProduct = dtbl.Copy(); DataTable dtblCompany = spcompany.CompanyViewDataTable(1); if (dgvProductBatch.Rows.Count > 0) { DataTable dtblNew = dtbl.Copy(); ds.Tables.Add(dtblCompany); ds.Tables.Add(dtblProduct); frmReport frmReport = new frmReport(); frmReport.MdiParent = formMDI.MDIObj; frmReport.ProductBatchReportPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show(" PVSBR:9" + 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 (dgvEmployee.RowCount > 0) { DataSet ds = new DataSet(); CompanySP spCompany = new CompanySP(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); EmployeeSP spEmployee = new EmployeeSP(); DataTable dtblEmployee = spEmployee.EmployeeViewAllEmployeeReport(cmbDesigantion.Text, cmbEmployee.Text, cmbStatus.Text); ds.Tables.Add(dtblEmployee); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.EmployeeReportPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("ER9" + 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 { if (dgvContraReport.RowCount > 0) { DataSet ds = new DataSet(); CompanySP spCompany = new CompanySP(); frmReport reportobj = new frmReport(); ContraMasterSP spContraMaster = new ContraMasterSP(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); DataTable dtblCotraReport = spContraMaster.ContraReport(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), cmbVoucherType.Text, cmbCashOrBank.Text, strType); ds.Tables.Add(dtblCompany); ds.Tables.Add(dtblCotraReport); 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> /// on "print' button click for print /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvServiceReport.RowCount > 0) { DataSet dsServiceVoucherReport = new DataSet(); CompanySP spCompany = new CompanySP(); frmReport reportobj = new frmReport(); ServiceMasterSP spServiceMaster = new ServiceMasterSP(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); DataTable dtblServiceVoucherReport = spServiceMaster.ServiceReport(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), cmbVoucherType.Text, cmbCashOrParty.Text, cmbSalesman.Text); dsServiceVoucherReport.Tables.Add(dtblCompany); dsServiceVoucherReport.Tables.Add(dtblServiceVoucherReport); reportobj.MdiParent = formMDI.MDIObj; reportobj.ServiceVoucherReport(dsServiceVoucherReport); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("SVRT 15 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to save the items to database /// </summary> public void SaveFunction() { try { decimal decIdentity = 0; FinancialYearInfo infoFinancialYear = new FinancialYearInfo(); FinancialYearSP spFinancialYear = new FinancialYearSP(); CompanySP spCompany = new CompanySP(); infoFinancialYear.FromDate = Convert.ToDateTime(txtFromDate.Text); infoFinancialYear.ToDate = Convert.ToDateTime(txtToDate.Text); infoFinancialYear.ExtraDate = System.DateTime.Now; infoFinancialYear.Extra1 = string.Empty; infoFinancialYear.Extra2 = string.Empty; decIdentity = spFinancialYear.FinancialYearAddWithReturnIdentity(infoFinancialYear); infoFinancialYear = spFinancialYear.FinancialYearView(decIdentity); PublicVariables._decCurrentFinancialYearId = infoFinancialYear.FinancialYearId; PublicVariables._dtFromDate = infoFinancialYear.FromDate; PublicVariables._dtToDate = infoFinancialYear.ToDate; PublicVariables._dtCurrentDate = infoFinancialYear.FromDate; spCompany.CompanyCurrentDateEdit(PublicVariables._dtCurrentDate); formMDI.MDIObj.ShowCurrentDate(); isSave = true; this.Close(); } catch (Exception ex) { MessageBox.Show("NFY 2 : " + 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(); DataTable dtblEmployee = spEmployee.EmployeeViewAllForDailySalaryReport(cmbEmployeeCode.Text, cmbDesignation.Text, Convert.ToDateTime(dtpFromDate.Text.ToString()), Convert.ToDateTime(dtpToDate.Text.ToString()), cmbStatus.Text); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); ds.Tables.Add(dtblEmployee); 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 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(); infoComapany = spCompany.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 = spCompany.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> /// On 'Print' button click to print the data /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvPurchaseReturnReport.Rows.Count > 0) { if (dgvPurchaseReturnReport.Rows.Count > 0) { DataSet dsPurchaseReturnReport = new DataSet(); CompanySP spCompany = new CompanySP(); DataTable dtblGrid = dtblReg.Copy(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); dsPurchaseReturnReport.Tables.Add(dtblGrid); dsPurchaseReturnReport.Tables.Add(dtblCompany); frmReport frmReport = new frmReport(); frmReport.MdiParent = formMDI.MDIObj; frmReport.PurchaseReturnReportPrinting(dsPurchaseReturnReport, txtTotalAmount.Text); } } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("PRRT:13" + 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(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); AdvancePaymentSP spAdvancePayment = new AdvancePaymentSP(); DataTable dtblAdvancePayment = new DataTable(); dtblAdvancePayment = spAdvancePayment.AdvancePaymentViewAllForAdvancePaymentReport(dtpFrmDate.Value, dtpToDate.Value, cmbEmployeeCode.Text, DateTime.Parse(dtpSalaryMonth.Text.ToString())); ds.Tables.Add(dtblAdvancePayment); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.AdvancePaymentReportPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { formMDI.infoError.ErrorString = "APR:8 " + ex.Message; } }
/// <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(); PayHeadSP spPayHead = new PayHeadSP(); DataTable dtbl = spPayHead.PayHeadViewAllForPayHeadReport(cmbPayHead.Text, cmbType.Text); CompanySP spCompany = new CompanySP(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); frmReport frmreport = new frmReport(); frmreport.MdiParent = formMDI.MDIObj; ds.Tables.Add(dtbl); ds.Tables.Add(dtblCompany); frmreport.PayHeadReport(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("PHR:7 " + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// To set the From date and todate in corresponding fields /// </summary> public void FinancialYearDate() { try { dtpFromDate.MinDate = PublicVariables._dtFromDate; dtpFromDate.MaxDate = PublicVariables._dtToDate; CompanyInfo infoComapany = new CompanyInfo(); CompanySP spCompany = new CompanySP(); infoComapany = spCompany.CompanyView(1); DateTime dtFromDate = infoComapany.CurrentDate; dtpFromDate.Value = dtFromDate; dtpFromDate.Text = dtFromDate.ToString("dd-MMM-yyyy"); dtpFromDate.Value = Convert.ToDateTime(txtFromDate.Text); txtFromDate.Focus(); txtFromDate.SelectAll(); dtpToDate.MinDate = PublicVariables._dtFromDate; dtpToDate.MaxDate = PublicVariables._dtToDate; infoComapany = spCompany.CompanyView(1); DateTime dtToDate = infoComapany.CurrentDate; dtpToDate.Value = dtToDate; dtpToDate.Text = dtToDate.ToString("dd-MMM-yyyy"); dtpToDate.Value = Convert.ToDateTime(txtToDate.Text); txtToDate.Focus(); txtToDate.SelectAll(); } catch (Exception ex) { formMDI.infoError.ErrorString = "CRNTREP4:" + ex.Message; } }
/// <summary> /// On 'Print' button click for print /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvMonthlySalary.Rows.Count > 0) { DataSet ds = new DataSet(); CompanySP spCompany = new CompanySP(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); MonthlySalarySP spMonthlySalary = new MonthlySalarySP(); DataTable dtblMonthlySalary = spMonthlySalary.MonthlySalryViewAllForMonthlySalaryReports(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), cmbDesignation.Text, cmbEmployeeCode.Text, Convert.ToDateTime(dtpSalaryMonth.Value.ToString())); ds.Tables.Add(dtblMonthlySalary); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.MonthlySalaryReportPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { formMDI.infoError.ErrorString = "MSR:9" + ex.Message; } }
/// <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 (dgvEmployeeAddressBook.Rows.Count > 0) { DataSet ds = new DataSet(); CompanySP spCompany = new CompanySP(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); EmployeeSP spEmployee = new EmployeeSP(); DataTable dtblEmployee = spEmployee.EmployeeViewAllForEmployeeAddressBook(cmbEmployeeCode.Text, txtMobile.Text, txtPhone.Text, txtEmail.Text); ds.Tables.Add(dtblEmployee); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.EmployeeAddressBookPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { formMDI.infoError.ErrorString = "EMP-AB8 " + ex.Message; } }
/// <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 (dgvSalaryPackage.RowCount > 0) { frmReport frmreport = new frmReport(); DataSet ds = new DataSet(); SalaryPackageSP spSalaryPackage = new SalaryPackageSP(); CompanySP spCompany = new CompanySP(); DataTable dtblSalaryPackage = spSalaryPackage.SalaryPackageViewAllForSalaryPackageReport(cmbPackageName.Text, cmbStatus.Text); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblSalaryPackage); ds.Tables.Add(dtblCompany); frmreport.MdiParent = formMDI.MDIObj; frmreport.SalaryPackageReport(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("SPD:9 " + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Start a login /// </summary> public void Login() { try { UserSP spUser = new UserSP(); CompanySP spCompany = new CompanySP(); CompanyInfo infoCompany = new CompanyInfo(); string strUserName = txtUserName.Text.Trim(); string strPassword = spUser.LoginCheck(strUserName); if (strPassword == txtPassword.Text.Trim() && strPassword != string.Empty) { int inUserId = spUser.GetUserIdAfterLogin(strUserName, strPassword); PublicVariables._decCurrentUserId = inUserId; infoCompany = spCompany.CompanyView(1); PublicVariables._decCurrencyId = infoCompany.CurrencyId; formMDI.MDIObj.CallFromLogin(); SettingsCheck(); //for Quock Launch menu formMDI.MDIObj.ShowQuickLaunchMenu(); formMDI.MDIObj.CurrentSettings(); //Display ChangeCurrentDate form// frmChangeCurrentDate frmCurrentDateChangeObj = new frmChangeCurrentDate(); frmCurrentDateChangeObj.MdiParent = formMDI.MDIObj; frmCurrentDateChangeObj.CallFromLogin(this); formMDI.MDIObj.Text = "OpenMiracle " + infoCompany.CompanyName + " [ " + PublicVariables._dtFromDate.ToString("dd-MMM-yyyy") + " To " + PublicVariables._dtToDate.ToString("dd-MMM-yyyy") + " ]"; // For showing the OpenMiracle message from the website formMDI.MDIObj.logoutToolStripMenuItem.Enabled = true; if (PublicVariables.MessageToShow != string.Empty) { frmMessage frmMsg = new frmMessage(); frmMsg.lblHeading.Text = PublicVariables.MessageHeadear; frmMsg.lblMessage.Text = PublicVariables.MessageToShow; frmMsg.MdiParent = formMDI.MDIObj; frmMsg.Show(); frmMsg.Location = new Point(0, formMDI.MDIObj.Height - 270); foreach (Form form in Application.OpenForms) { if (form.GetType() == typeof(frmChangeCurrentDate)) { form.Focus(); } } } } else { Messages.InformationMessage("Invalid username or password"); Clear(); } } catch (Exception ex) { MessageBox.Show("LOGIN02:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Datagridview /// </summary> public void CompanyGridFill() { try { DataTable dtbl = new DataTable(); CompanySP spComapny = new CompanySP(); dtbl = spComapny.CompanyViewAllForSelectCompany(); dgvSelectCompany.DataSource = dtbl; } catch (Exception ex) { formMDI.infoError.ErrorString = "SELCMPNY : 1" + ex.Message; } }
/// <summary> /// Function to fill Datagridview /// </summary> public void CompanyGridFill() { try { DataTable dtbl = new DataTable(); CompanySP spComapny = new CompanySP(); dtbl = spComapny.CompanyViewAllForSelectCompany(); dgvSelectCompany.DataSource = dtbl; } catch (Exception ex) { MessageBox.Show("SELCMPNY : 1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to Set the from date and todate based on the settings /// </summary> public void FinancialYearDate() { try { dtpFrmDate.MinDate = PublicVariables._dtFromDate; dtpFrmDate.MaxDate = PublicVariables._dtToDate; CompanyInfo infoComapany = new CompanyInfo(); CompanySP spCompany = new CompanySP(); infoComapany = spCompany.CompanyView(1); DateTime dtFromDate = PublicVariables._dtFromDate; dtpFrmDate.Value = dtFromDate; txtFromDate.Text = dtFromDate.ToString("dd-MMM-yyyy"); dtpFrmDate.Value = Convert.ToDateTime(txtFromDate.Text); txtFromDate.Focus(); txtFromDate.SelectAll(); dtpToDate.MinDate = PublicVariables._dtFromDate; dtpToDate.MaxDate = PublicVariables._dtToDate; infoComapany = spCompany.CompanyView(1); DateTime dtToDate = infoComapany.CurrentDate; dtpToDate.Value = dtToDate; txtToDate.Text = dtToDate.ToString("dd-MMM-yyyy"); dtpToDate.Value = Convert.ToDateTime(txtToDate.Text); txtToDate.Focus(); txtToDate.SelectAll(); dtpCheckDateFrom.MinDate = PublicVariables._dtFromDate; dtpCheckDateFrom.MaxDate = PublicVariables._dtToDate; infoComapany = spCompany.CompanyView(1); DateTime dtCheckdateFrom = infoComapany.CurrentDate; dtpCheckDateFrom.Value = dtCheckdateFrom; txtcheckdateFrom.Text = dtCheckdateFrom.ToString("dd-MMM-yyyy"); dtpCheckDateFrom.Value = Convert.ToDateTime(txtcheckdateFrom.Text); txtcheckdateFrom.Focus(); txtcheckdateFrom.SelectAll(); dtpCheckDateTo.MinDate = PublicVariables._dtFromDate; dtpCheckDateTo.MaxDate = PublicVariables._dtToDate; infoComapany = spCompany.CompanyView(1); DateTime dtCheckdateTo = infoComapany.CurrentDate; dtpCheckDateTo.Value = dtCheckdateTo; txtCheckDateTo.Text = dtCheckdateTo.ToString("dd-MMM-yyyy"); dtpCheckDateTo.Value = Convert.ToDateTime(txtCheckDateTo.Text); txtCheckDateTo.Focus(); txtCheckDateTo.SelectAll(); } catch (Exception ex) { MessageBox.Show("PRREP1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// to set the from date and todate based on settings /// </summary> public void FinancialYearDate() { try { dtpFrmDate.MinDate = PublicVariables._dtFromDate; dtpFrmDate.MaxDate = PublicVariables._dtToDate; CompanyInfo infoComapany = new CompanyInfo(); CompanySP spCompany = new CompanySP(); infoComapany = spCompany.CompanyView(1); DateTime dtFromDate = PublicVariables._dtFromDate; dtpFrmDate.Value = dtFromDate; dtpFrmDate.Text = dtFromDate.ToString("dd-MMM-yyyy"); dtpFrmDate.Value = Convert.ToDateTime(txtFromDate.Text); txtFromDate.Focus(); txtFromDate.SelectAll(); dtpTodate.MinDate = PublicVariables._dtFromDate; dtpTodate.MaxDate = PublicVariables._dtToDate; infoComapany = spCompany.CompanyView(1); DateTime dtToDate = infoComapany.CurrentDate; dtpTodate.Value = dtToDate; dtpTodate.Text = dtToDate.ToString("dd-MMM-yyyy"); dtpTodate.Value = Convert.ToDateTime(txtTodate.Text); txtTodate.Focus(); txtTodate.SelectAll(); dtpCheckDateFrom.MinDate = PublicVariables._dtFromDate; dtpCheckDateFrom.MaxDate = PublicVariables._dtToDate; infoComapany = spCompany.CompanyView(1); DateTime dtCheckdateFrom = infoComapany.CurrentDate; dtpCheckDateFrom.Value = dtCheckdateFrom; dtpCheckDateFrom.Text = dtCheckdateFrom.ToString("dd-MMM-yyyy"); dtpCheckDateFrom.Value = Convert.ToDateTime(txtcheckdateFrom.Text); txtcheckdateFrom.Focus(); txtcheckdateFrom.SelectAll(); dtpCheckdateTo.MinDate = PublicVariables._dtFromDate; dtpCheckdateTo.MaxDate = PublicVariables._dtToDate; infoComapany = spCompany.CompanyView(1); DateTime dtCheckdateTo = infoComapany.CurrentDate; dtpCheckdateTo.Value = dtCheckdateTo; dtpCheckdateTo.Text = dtCheckdateTo.ToString("dd-MMM-yyyy"); dtpCheckdateTo.Value = Convert.ToDateTime(txtcheckdateTo.Text); txtcheckdateTo.Focus(); txtcheckdateTo.SelectAll(); } catch (Exception ex) { MessageBox.Show("PPREP4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// To Display the company name in text box /// </summary> public void txtcompanynamefill() { try { CompanySP spcompany = new CompanySP(); CompanyInfo infoCompany = new CompanyInfo(); infoCompany = spcompany.CompanyView(1); string strCompanyName = infoCompany.CompanyName; txtShowCompanyName.Text = strCompanyName; txtShowCompanyName.ReadOnly = true; } catch (Exception ex) { MessageBox.Show("BS3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// To Display the company name in text box /// </summary> public void txtcompanynamefill() { try { CompanySP spcompany = new CompanySP(); CompanyInfo infoCompany = new CompanyInfo(); infoCompany = spcompany.CompanyView(1); string strCompanyName = infoCompany.CompanyName; txtShowCompanyName.Text = strCompanyName; txtShowCompanyName.ReadOnly = true; } catch (Exception ex) { formMDI.infoError.ErrorString = "BS3:" + ex.Message; } }
/// <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(); CompanySP spCompany = new CompanySP(); PriceListSP spPriceList = new PriceListSP(); DataTable dtblPriceList = spPricingList.PriceListReportPrint(decGroupId, strProductName, decSizeId, decModelId, decPricingLevelId); DataTable dtblCompanyReport = spCompany.CompanyViewDataTable(1); DataTable dtblPriceListGridFill = dtblPriceListReport.Copy(); ds.Tables.Add(dtblCompanyReport); ds.Tables.Add(dtblPriceList); 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> /// To set current date /// </summary> public void CurrentDate() { try { dtpCompanyCurrentDate.MinDate = PublicVariables._dtFromDate; dtpCompanyCurrentDate.MaxDate = PublicVariables._dtToDate; CompanyInfo infoComapany = new CompanyInfo(); CompanySP spCompany = new CompanySP(); infoComapany = spCompany.CompanyView(1); DateTime dtCurrentDate = PublicVariables._dtFromDate; if (infoComapany.CurrentDate != null) { dtCurrentDate = infoComapany.CurrentDate; } if (dtCurrentDate > PublicVariables._dtToDate) { dtCurrentDate = PublicVariables._dtToDate; } if (dtCurrentDate < PublicVariables._dtFromDate) { dtCurrentDate = PublicVariables._dtFromDate; } dtpCompanyCurrentDate.Value = dtCurrentDate; PublicVariables._dtCurrentDate = dtCurrentDate; DateTime sysDate = System.DateTime.Today; if (sysDate >= PublicVariables._dtFromDate && sysDate <= PublicVariables._dtToDate) { txtCompanyCurrentdate.Text = sysDate.ToString("dd-MMM-yyyy"); } else { txtCompanyCurrentdate.Text = dtCurrentDate.ToString("dd-MMM-yyyy"); } dtpCompanyCurrentDate.Value = Convert.ToDateTime(txtCompanyCurrentdate.Text); txtCompanyCurrentdate.Focus(); txtCompanyCurrentdate.SelectAll(); } catch (Exception ex) { formMDI.infoError.ErrorString = "CCD 3 : " + ex.Message; } }
/// <summary> /// To set current date /// </summary> public void CurrentDate() { try { dtpCompanyCurrentDate.MinDate = PublicVariables._dtFromDate; dtpCompanyCurrentDate.MaxDate = PublicVariables._dtToDate; CompanyInfo infoComapany = new CompanyInfo(); CompanySP spCompany = new CompanySP(); infoComapany = spCompany.CompanyView(1); DateTime dtCurrentDate = PublicVariables._dtFromDate; if (infoComapany.CurrentDate != null) { dtCurrentDate = infoComapany.CurrentDate; } if (dtCurrentDate > PublicVariables._dtToDate) { dtCurrentDate = PublicVariables._dtToDate; } if (dtCurrentDate < PublicVariables._dtFromDate) { dtCurrentDate = PublicVariables._dtFromDate; } dtpCompanyCurrentDate.Value = dtCurrentDate; PublicVariables._dtCurrentDate = dtCurrentDate; DateTime sysDate = System.DateTime.Today; if (sysDate >= PublicVariables._dtFromDate && sysDate <= PublicVariables._dtToDate) { txtCompanyCurrentdate.Text = sysDate.ToString("dd-MMM-yyyy"); } else { txtCompanyCurrentdate.Text = dtCurrentDate.ToString("dd-MMM-yyyy"); } dtpCompanyCurrentDate.Value = Convert.ToDateTime(txtCompanyCurrentdate.Text); txtCompanyCurrentdate.Focus(); txtCompanyCurrentdate.SelectAll(); } catch (Exception ex) { MessageBox.Show("CCD 3 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to Get the Current Date /// </summary> public void CurrentDate() { try { CompanyInfo infoComapany = new CompanyInfo(); CompanySP spCompany = new CompanySP(); FinancialYearInfo infoFinancialYear = new FinancialYearInfo(); FinancialYearSP spFinancialYear = new FinancialYearSP(); infoComapany = spCompany.CompanyView(1); PublicVariables._dtCurrentDate = infoComapany.CurrentDate; infoFinancialYear = spFinancialYear.FinancialYearView(1); PublicVariables._dtFromDate = infoFinancialYear.FromDate; PublicVariables._dtToDate = infoFinancialYear.ToDate; } catch (Exception ex) { MessageBox.Show("SELCMPNY :2 " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to Get the Current Date /// </summary> public void CurrentDate() { try { CompanyInfo infoComapany = new CompanyInfo(); CompanySP spCompany = new CompanySP(); FinancialYearInfo infoFinancialYear = new FinancialYearInfo(); FinancialYearSP spFinancialYear = new FinancialYearSP(); infoComapany = spCompany.CompanyView(1); PublicVariables._dtCurrentDate = infoComapany.CurrentDate; infoFinancialYear = spFinancialYear.FinancialYearView(1); PublicVariables._dtFromDate = infoFinancialYear.FromDate; PublicVariables._dtToDate = infoFinancialYear.ToDate; } catch (Exception ex) { formMDI.infoError.ErrorString = "SELCMPNY : 2" + ex.Message; } }
/// <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 (dgvMonthlyAttendance.Rows.Count > 0) { DataSet ds = new DataSet(); CompanySP spCompany = new CompanySP(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); DataTable dtblMonthlyAttendance = new DataTable(); dtblMonthlyAttendance.Columns.Add("SlNo", typeof(Int32)); dtblMonthlyAttendance.Columns.Add("employeeCode", typeof(string)); dtblMonthlyAttendance.Columns.Add("employeeName", typeof(string)); dtblMonthlyAttendance.Columns.Add("Present", typeof(string)); dtblMonthlyAttendance.Columns.Add("Absent", typeof(string)); foreach (DataGridViewRow dgvrow in dgvMonthlyAttendance.Rows) { dtblMonthlyAttendance.Rows.Add(); dtblMonthlyAttendance.Rows[dgvrow.Index]["SlNo"] = dgvrow.Cells["SlNo"].Value; dtblMonthlyAttendance.Rows[dgvrow.Index]["employeeCode"] = dgvrow.Cells["employeeCode"].Value; dtblMonthlyAttendance.Rows[dgvrow.Index]["employeeName"] = dgvrow.Cells["employeeName"].Value; dtblMonthlyAttendance.Rows[dgvrow.Index]["Present"] = dgvrow.Cells["Present"].Value; dtblMonthlyAttendance.Rows[dgvrow.Index]["Absent"] = dgvrow.Cells["Absent"].Value; } ds.Tables.Add(dtblMonthlyAttendance); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.MonthlyAttendancePrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("MAR15 " + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to set financial year date /// </summary> public void FinancialYearDate() { try { //-----For FromDate----// dtpFromDate.MinDate = PublicVariables._dtFromDate; dtpFromDate.MaxDate = PublicVariables._dtToDate; CompanyInfo infoComapany = new CompanyInfo(); CompanySP spCompany = new CompanySP(); infoComapany = spCompany.CompanyView(1); DateTime dtFromDate = infoComapany.CurrentDate; dtpFromDate.Value = dtFromDate; dtpFromDate.Text = dtFromDate.ToString("dd-MMM-yyyy"); dtpFromDate.Value = Convert.ToDateTime(txtFromDate.Text); txtFromDate.Focus(); txtFromDate.SelectAll(); //==============================// //-----For ToDate-----------------// dtpToDate.MinDate = PublicVariables._dtFromDate; dtpToDate.MaxDate = PublicVariables._dtToDate; infoComapany = spCompany.CompanyView(1); DateTime dtToDate = infoComapany.CurrentDate; dtpToDate.Value = dtToDate; dtpToDate.Text = dtToDate.ToString("dd-MMM-yyyy"); dtpToDate.Value = Convert.ToDateTime(txtToDate.Text); txtToDate.Focus(); txtToDate.SelectAll(); //=====================// } catch (Exception ex) { MessageBox.Show("AGR:3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to get the count of created companies /// </summary> public void CompanyCount() { try { CompanySP spCompany = new CompanySP(); decimal decCount = spCompany.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> /// 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; CompanySP spCompany = new CompanySP(); CompanyInfo infoCompany = new CompanyInfo(); decimal decCompanyId = 1; infoCompany = spCompany.CompanyView(decCompanyId); 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(); CompanyPathSP spComapnyPath = new CompanyPathSP(); infoCompanyPath = spComapnyPath.CompanyPathView(1); if (infoCompanyPath.IsDefault == true) { cbxSetAsDefault.Checked = true; } else { cbxSetAsDefault.Checked = false; } UserSP spUser = new UserSP(); UserInfo infoUser = new UserInfo(); decimal decuserId = PublicVariables._decCurrentUserId; infoUser = spUser.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 for print /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvMonthlySalary.Rows.Count > 0) { DataSet ds = new DataSet(); CompanySP spCompany = new CompanySP(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); MonthlySalarySP spMonthlySalary = new MonthlySalarySP(); DataTable dtblMonthlySalary = spMonthlySalary.MonthlySalryViewAllForMonthlySalaryReports(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), cmbDesignation.Text, cmbEmployeeCode.Text, Convert.ToDateTime(dtpSalaryMonth.Value.ToString())); ds.Tables.Add(dtblMonthlySalary); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.MonthlySalaryReportPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("MSR:9" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Adding columns to print /// </summary> /// <param name="decDeliveryNoteMasterId"></param> public void PrintForDotMatrix(decimal decDeliveryNoteMasterId) { try { DataTable dtblOtherDetails = new DataTable(); CompanySP spComapany = new CompanySP(); dtblOtherDetails = spComapany.CompanyViewForDotMatrix(); //-------------Grid Details-------------------\\ DataTable dtblGridDetails = new DataTable(); dtblGridDetails.Columns.Add("SlNo"); dtblGridDetails.Columns.Add("BarCode"); dtblGridDetails.Columns.Add("ProductCode"); dtblGridDetails.Columns.Add("ProductName"); dtblGridDetails.Columns.Add("Qty"); dtblGridDetails.Columns.Add("Unit"); dtblGridDetails.Columns.Add("Godown"); dtblGridDetails.Columns.Add("Rack"); dtblGridDetails.Columns.Add("Batch"); dtblGridDetails.Columns.Add("Rate"); dtblGridDetails.Columns.Add("Amount"); int inRowCount = 0; foreach (DataGridViewRow dRow in dgvProduct.Rows) { if (!dRow.IsNewRow) { DataRow dr = dtblGridDetails.NewRow(); dr["SlNo"] = ++inRowCount; if (dRow.Cells["dgvtxtBarcode"].Value != null) { dr["BarCode"] = dRow.Cells["dgvtxtBarcode"].Value.ToString(); } if (dRow.Cells["dgvtxtProductCode"].Value != null) { dr["ProductCode"] = dRow.Cells["dgvtxtProductCode"].Value.ToString(); } if (dRow.Cells["dgvtxtProductName"].Value != null) { dr["ProductName"] = dRow.Cells["dgvtxtProductName"].Value.ToString(); } if (dRow.Cells["dgvtxtQty"].Value != null) { dr["Qty"] = dRow.Cells["dgvtxtQty"].Value.ToString(); } if (dRow.Cells["dgvcmbUnit"].Value != null) { dr["Unit"] = dRow.Cells["dgvcmbUnit"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbGodown"].Value != null) { dr["Godown"] = dRow.Cells["dgvcmbGodown"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbRack"].Value != null) { dr["Rack"] = dRow.Cells["dgvcmbRack"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbBatch"].Value != null) { dr["Batch"] = dRow.Cells["dgvcmbBatch"].FormattedValue.ToString(); } if (dRow.Cells["dgvtxtRate"].Value != null) { dr["Rate"] = dRow.Cells["dgvtxtRate"].Value.ToString(); } if (dRow.Cells["dgvtxtAmount"].Value != null) { dr["Amount"] = dRow.Cells["dgvtxtAmount"].Value.ToString(); } dtblGridDetails.Rows.Add(dr); } } //-------------Other Details-------------------\\ dtblOtherDetails.Columns.Add("voucherNo"); dtblOtherDetails.Columns.Add("date"); dtblOtherDetails.Columns.Add("ledgerName"); dtblOtherDetails.Columns.Add("Narration"); dtblOtherDetails.Columns.Add("Currency"); dtblOtherDetails.Columns.Add("TotalAmount"); dtblOtherDetails.Columns.Add("DeliveryMode"); dtblOtherDetails.Columns.Add("PricingLevel"); dtblOtherDetails.Columns.Add("Type"); dtblOtherDetails.Columns.Add("SalesMan"); dtblOtherDetails.Columns.Add("CustomerAddress"); dtblOtherDetails.Columns.Add("CustomerTIN"); dtblOtherDetails.Columns.Add("CustomerCST"); dtblOtherDetails.Columns.Add("AmountInWords"); dtblOtherDetails.Columns.Add("Declaration"); dtblOtherDetails.Columns.Add("Heading1"); dtblOtherDetails.Columns.Add("Heading2"); dtblOtherDetails.Columns.Add("Heading3"); dtblOtherDetails.Columns.Add("Heading4"); DataRow dRowOther = dtblOtherDetails.Rows[0]; dRowOther["voucherNo"] = txtDeliveryNoteNo.Text; dRowOther["date"] = txtDate.Text; dRowOther["ledgerName"] = cmbCashOrParty.Text; dRowOther["Narration"] = txtNarration.Text; dRowOther["Currency"] = cmbCurrency.Text; dRowOther["TotalAmount"] = txtTotalAmnt.Text; dRowOther["DeliveryMode"] = cmbDeliveryMode.Text; dRowOther["PricingLevel"] = cmbPricingLevel.Text; dRowOther["Type"] = cmbType.Text; dRowOther["SalesMan"] = cmbSalesMan.Text; dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", ""); AccountLedgerSP spAccountLedger = new AccountLedgerSP(); AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo(); infoAccountLedger = spAccountLedger.AccountLedgerView(Convert.ToDecimal(cmbCashOrParty.SelectedValue)); dRowOther["CustomerAddress"] = (infoAccountLedger.Address.ToString().Replace("\n", ", ")).Replace("\r", ""); dRowOther["CustomerTIN"] = infoAccountLedger.Tin; dRowOther["CustomerCST"] = infoAccountLedger.Cst; dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtTotalAmnt.Text), PublicVariables._decCurrencyId); VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtblDeclaration = spVoucherType.DeclarationAndHeadingGetByVoucherTypeId(decDeliveryNoteVoucherTypeId); dRowOther["Declaration"] = dtblDeclaration.Rows[0]["Declaration"].ToString(); dRowOther["Heading1"] = dtblDeclaration.Rows[0]["Heading1"].ToString(); dRowOther["Heading2"] = dtblDeclaration.Rows[0]["Heading2"].ToString(); dRowOther["Heading3"] = dtblDeclaration.Rows[0]["Heading3"].ToString(); dRowOther["Heading4"] = dtblDeclaration.Rows[0]["Heading4"].ToString(); int inFormId = spVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString())); PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails); } catch (Exception ex) { MessageBox.Show("DN41:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to get the current Date /// </summary> public void CurrentDate() { try { CompanyInfo infoComapany = new CompanyInfo(); CompanySP spCompany = new CompanySP(); FinancialYearInfo infoFinancialYear = new FinancialYearInfo(); FinancialYearSP spFinancialYear = new FinancialYearSP(); infoComapany = spCompany.CompanyView(1); PublicVariables._dtCurrentDate = infoComapany.CurrentDate; infoFinancialYear = spFinancialYear.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> /// Print function for dotmatrix printer /// </summary> /// <param name="decSalesMasterId"></param> public void PrintForDotMatrix(decimal decSalesMasterId) { try { DataTable dtblOtherDetails = new DataTable(); CompanySP spComapany = new CompanySP(); dtblOtherDetails = spComapany.CompanyViewForDotMatrix(); DataTable dtblGridDetails = new DataTable(); dtblGridDetails.Columns.Add("SlNo"); dtblGridDetails.Columns.Add("BarCode"); dtblGridDetails.Columns.Add("ProductCode"); dtblGridDetails.Columns.Add("ProductName"); dtblGridDetails.Columns.Add("Qty"); dtblGridDetails.Columns.Add("Unit"); dtblGridDetails.Columns.Add("Godown"); dtblGridDetails.Columns.Add("Brand"); dtblGridDetails.Columns.Add("Tax"); dtblGridDetails.Columns.Add("TaxAmount"); dtblGridDetails.Columns.Add("NetAmount"); dtblGridDetails.Columns.Add("DiscountAmount"); dtblGridDetails.Columns.Add("DiscountPercentage"); dtblGridDetails.Columns.Add("SalesRate"); dtblGridDetails.Columns.Add("PurchaseRate"); dtblGridDetails.Columns.Add("MRP"); dtblGridDetails.Columns.Add("Rack"); dtblGridDetails.Columns.Add("Batch"); dtblGridDetails.Columns.Add("Rate"); dtblGridDetails.Columns.Add("Amount"); int inRowCount = 0; foreach (DataGridViewRow dRow in dgvSalesInvoice.Rows) { if (!dRow.IsNewRow) { DataRow dr = dtblGridDetails.NewRow(); dr["SlNo"] = ++inRowCount; if (dRow.Cells["dgvtxtSalesInvoiceBarcode"].Value != null) { dr["BarCode"] = dRow.Cells["dgvtxtSalesInvoiceBarcode"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceProductCode"].Value != null) { dr["ProductCode"] = dRow.Cells["dgvtxtSalesInvoiceProductCode"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceProductName"].Value != null) { dr["ProductName"] = dRow.Cells["dgvtxtSalesInvoiceProductName"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceQty"].Value != null) { dr["Qty"] = dRow.Cells["dgvtxtSalesInvoiceQty"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoicembUnitName"].Value != null) { dr["Unit"] = dRow.Cells["dgvtxtSalesInvoicembUnitName"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbSalesInvoiceGodown"].Value != null) { dr["Godown"] = dRow.Cells["dgvcmbSalesInvoiceGodown"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbSalesInvoiceRack"].Value != null) { dr["Rack"] = dRow.Cells["dgvcmbSalesInvoiceRack"].FormattedValue.ToString(); } if (dRow.Cells["dgvcmbSalesInvoiceBatch"].Value != null) { dr["Batch"] = dRow.Cells["dgvcmbSalesInvoiceBatch"].FormattedValue.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceRate"].Value != null) { dr["Rate"] = dRow.Cells["dgvtxtSalesInvoiceRate"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceAmount"].Value != null) { dr["Amount"] = dRow.Cells["dgvtxtSalesInvoiceAmount"].Value.ToString(); } if (dRow.Cells["dgvcmbSalesInvoiceTaxName"].Value != null) { dr["Tax"] = dRow.Cells["dgvcmbSalesInvoiceTaxName"].FormattedValue.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceBrand"].Value != null) { dr["Brand"] = dRow.Cells["dgvtxtSalesInvoiceBrand"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceTaxAmount"].Value != null) { dr["TaxAmount"] = dRow.Cells["dgvtxtSalesInvoiceTaxAmount"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceNetAmount"].Value != null) { dr["NetAmount"] = dRow.Cells["dgvtxtSalesInvoiceNetAmount"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceDiscountAmount"].Value != null) { dr["DiscountAmount"] = dRow.Cells["dgvtxtSalesInvoiceDiscountAmount"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceDiscountPercentage"].Value != null) { dr["DiscountPercentage"] = dRow.Cells["dgvtxtSalesInvoiceDiscountPercentage"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceSalesRate"].Value != null) { dr["SalesRate"] = dRow.Cells["dgvtxtSalesInvoiceSalesRate"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoicePurchaseRate"].Value != null) { dr["PurchaseRate"] = dRow.Cells["dgvtxtSalesInvoicePurchaseRate"].Value.ToString(); } if (dRow.Cells["dgvtxtSalesInvoiceMrp"].Value != null) { dr["MRP"] = dRow.Cells["dgvtxtSalesInvoiceMrp"].Value.ToString(); } dtblGridDetails.Rows.Add(dr); } } dtblOtherDetails.Columns.Add("voucherNo"); dtblOtherDetails.Columns.Add("date"); dtblOtherDetails.Columns.Add("ledgerName"); dtblOtherDetails.Columns.Add("SalesMode"); dtblOtherDetails.Columns.Add("SalesAccount"); dtblOtherDetails.Columns.Add("SalesMan"); dtblOtherDetails.Columns.Add("CreditPeriod"); dtblOtherDetails.Columns.Add("VoucherType"); dtblOtherDetails.Columns.Add("PricingLevel"); dtblOtherDetails.Columns.Add("Customer"); dtblOtherDetails.Columns.Add("CustomerAddress"); dtblOtherDetails.Columns.Add("CustomerTIN"); dtblOtherDetails.Columns.Add("CustomerCST"); dtblOtherDetails.Columns.Add("Narration"); dtblOtherDetails.Columns.Add("Currency"); dtblOtherDetails.Columns.Add("TotalAmount"); dtblOtherDetails.Columns.Add("BillDiscount"); dtblOtherDetails.Columns.Add("GrandTotal"); dtblOtherDetails.Columns.Add("AmountInWords"); dtblOtherDetails.Columns.Add("Declaration"); dtblOtherDetails.Columns.Add("Heading1"); dtblOtherDetails.Columns.Add("Heading2"); dtblOtherDetails.Columns.Add("Heading3"); dtblOtherDetails.Columns.Add("Heading4"); DataRow dRowOther = dtblOtherDetails.Rows[0]; dRowOther["voucherNo"] = txtInvoiceNo.Text; dRowOther["date"] = txtDate.Text; dRowOther["ledgerName"] = cmbCashOrParty.Text; dRowOther["Narration"] = txtNarration.Text; dRowOther["Currency"] = cmbCurrency.Text; dRowOther["SalesMode"] = cmbSalesMode.Text; dRowOther["SalesAccount"] = cmbSalesAccount.Text; dRowOther["SalesMan"] = cmbSalesMan.SelectedText; dRowOther["CreditPeriod"] = (txtCreditPeriod.Text) + " Days"; dRowOther["PricingLevel"] = cmbPricingLevel.Text; dRowOther["Customer"] = txtCustomer.Text; dRowOther["BillDiscount"] = txtBillDiscount.Text; dRowOther["GrandTotal"] = txtGrandTotal.Text; dRowOther["TotalAmount"] = txtTotalAmount.Text; dRowOther["VoucherType"] = cmbVoucherType.Text; dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", ""); AccountLedgerSP spAccountLedger = new AccountLedgerSP(); AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo(); infoAccountLedger = spAccountLedger.AccountLedgerView(Convert.ToDecimal(cmbCashOrParty.SelectedValue)); dRowOther["CustomerAddress"] = (infoAccountLedger.Address.ToString().Replace("\n", ", ")).Replace("\r", ""); dRowOther["CustomerTIN"] = infoAccountLedger.Tin; dRowOther["CustomerCST"] = infoAccountLedger.Cst; dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtGrandTotal.Text), PublicVariables._decCurrencyId); VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtblDeclaration = spVoucherType.DeclarationAndHeadingGetByVoucherTypeId(DecSalesInvoiceVoucherTypeId); dRowOther["Declaration"] = dtblDeclaration.Rows[0]["Declaration"].ToString(); dRowOther["Heading1"] = dtblDeclaration.Rows[0]["Heading1"].ToString(); dRowOther["Heading2"] = dtblDeclaration.Rows[0]["Heading2"].ToString(); dRowOther["Heading3"] = dtblDeclaration.Rows[0]["Heading3"].ToString(); dRowOther["Heading4"] = dtblDeclaration.Rows[0]["Heading4"].ToString(); int inFormId = spVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString())); PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails); } catch (Exception ex) { MessageBox.Show("SI: 74" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Changing company's financial year /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSelect_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Are you sure you want to change the financial year?", "OpenMiracle", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { FinancialYearInfo infoFinancialYear = new FinancialYearInfo(); FinancialYearSP spFinancialYear = new FinancialYearSP(); decimal decFinacialId = Convert.ToDecimal(dgvChangeFinancialYear.CurrentRow.Cells["dgvtxtfinancialYearId"].Value); DateTime dtmFromDate = Convert.ToDateTime(dgvChangeFinancialYear.CurrentRow.Cells["dgvtxtFromDate"].Value); DateTime dtmToDate = Convert.ToDateTime(dgvChangeFinancialYear.CurrentRow.Cells["dgvtxtToDate"].Value); PublicVariables._decCurrentFinancialYearId = decFinacialId; PublicVariables._dtFromDate = dtmFromDate; PublicVariables._dtToDate = dtmToDate; DateTime dtGetCurrentdate = DateTime.Now; CompanySP spCompany = new CompanySP(); spCompany.CompanyCurrentDateEdit(dtmFromDate); if (dtGetCurrentdate < dtmFromDate) { PublicVariables._dtCurrentDate = dtmFromDate; spCompany.CompanyCurrentDateEdit(dtmFromDate); formMDI.MDIObj.ShowCurrentDate(); } else { PublicVariables._dtCurrentDate = dtGetCurrentdate; spCompany.CompanyCurrentDateEdit(dtmFromDate); formMDI.MDIObj.ShowCurrentDate(); } CompanyInfo infoCompany = new CompanyInfo(); infoCompany = spCompany.CompanyView(1); formMDI.MDIObj.Text = "OpenMiracle " + infoCompany.CompanyName + " [ " + PublicVariables._dtFromDate.ToString("dd-MMM-yyyy") + " To " + PublicVariables._dtToDate.ToString("dd-MMM-yyyy") + " ]"; this.Close(); } } catch (Exception ex) { MessageBox.Show("CHGFINYR:5" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to delete a company /// </summary> public void DeleteFunction() { try { decimal decCompanyIdForTemp = PublicVariables._decCurrentCompanyId; CompanySP spCompany = new CompanySP(); PublicVariables._decCurrentCompanyId = 0; CompanySP spExCompany = new CompanySP(); CompanyPathSP spExCompanyPath = new CompanyPathSP(); spExCompany.CompanyDelete(decCompanyIdForTemp); spExCompanyPath.CompanyPathDelete(decCompanyIdForTemp); Messages.DeletedMessage(); Application.Restart(); } catch (Exception ex) { MessageBox.Show("CR12:" + 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(); CompanySP spCompany = new CompanySP(); infoCompany = spCompany.CompanyView(1); PublicVariables._decCurrencyId = infoCompany.CurrencyId; } catch (Exception ex) { MessageBox.Show("CR11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function for Save /// </summary> public void SaveFunction() { try { CompanyInfo infoCompany = new CompanyInfo(); CompanySP spCompany = new CompanySP(); CompanyPathInfo infoCompanyPath = new CompanyPathInfo(); CompanyPathSP spCompanyPath = new CompanyPathSP(); UserInfo infoUser = new UserInfo(); UserSP spUser = new UserSP(); ExchangeRateInfo infoExchangeRate = new ExchangeRateInfo(); ExchangeRateSP spExchangeRate = new ExchangeRateSP(); 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 (spCompany.CompanyCheckExistence(txtCompanyName.Text.Trim().ToString(), 0) == false) { decimal decCompanyId = spCompany.CompanyAddParticularFeilds(infoCompany); PublicVariables._decCurrentCompanyId = decCompanyId; infoCompanyPath.CompanyPath = Application.StartupPath + "\\Data\\" + PublicVariables._decCurrentCompanyId; spCompanyPath.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(); CompanySP spNewCompany = new CompanySP(); CompanyPathInfo infoNewCompanyPath = new CompanyPathInfo(); CompanyPathSP spNewCompanyPath = new CompanyPathSP(); UserInfo infoNewUser = new UserInfo(); UserSP spNewUser = new UserSP(); ExchangeRateInfo infoNewExchangeRate = new ExchangeRateInfo(); ExchangeRateSP spNewExchangeRate = new ExchangeRateSP(); infoNewCompany = infoCompany; infoNewCompanyPath = infoCompanyPath; infoNewUser = infoUser; decCompanyId = spNewCompany.CompanyAddParticularFeilds(infoNewCompany); spNewUser.UserAdd(infoNewUser); spNewCompanyPath.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; spNewExchangeRate.ExchangeRateAdd(infoNewExchangeRate); CurrencySP spCurrency = new CurrencySP(); spCurrency.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> /// 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(); decimal decCompanyCount = spCompany.CompanyCount(); if (decCompanyCount != -1) { if (decCompanyCount == 1) { PublicVariables._decCurrentCompanyId = spCompany.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(); decimal decDefaultCompanyId = spCompanyPath.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); } }
/// <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(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); DataTable dtblBonusDeduction = spBonusDeduction.BonusDeductionReportGridFill(dtpFromDate.Text, dtpToDate.Text, dtpSalaryMonth.Text, cmbDesignation.Text, cmbEmployee.Text, strBonusOrDeduction); ds.Tables.Add(dtblBonusDeduction); 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> /// Dotmatrix print function add the details to fill here /// </summary> /// <param name="decPaymentMasterId"></param> public void PrintForDotMatrix(decimal decPaymentMasterId) { try { DataTable dtblOtherDetails = new DataTable(); CompanySP spComapany = new CompanySP(); dtblOtherDetails = spComapany.CompanyViewForDotMatrix(); DataTable dtblGridDetails = new DataTable(); dtblGridDetails.Columns.Add("SlNo"); dtblGridDetails.Columns.Add("Account Ledger"); dtblGridDetails.Columns.Add("Amount"); dtblGridDetails.Columns.Add("Currency"); dtblGridDetails.Columns.Add("Cheque No"); dtblGridDetails.Columns.Add("Cheque Date"); int inRowCount = 0; foreach (DataGridViewRow dRow in dgvPaymentVoucher.Rows) { if (dRow.HeaderCell.Value != null && dRow.HeaderCell.Value.ToString() != "X") { if (!dRow.IsNewRow) { DataRow dr = dtblGridDetails.NewRow(); dr["SlNo"] = ++inRowCount; dr["Account Ledger"] = dRow.Cells["dgvcmbAccountLedger"].FormattedValue.ToString(); dr["Amount"] = dRow.Cells["dgvtxtAmount"].Value.ToString(); dr["Currency"] = dRow.Cells["dgvcmbCurrency"].FormattedValue.ToString(); dr["Cheque No"] = (dRow.Cells["dgvtxtChequeNo"].Value == null ? "" : dRow.Cells["dgvtxtChequeNo"].Value.ToString()); dr["Cheque Date"] = (dRow.Cells["dgvtxtChequeDate"].Value == null ? "" : dRow.Cells["dgvtxtChequeDate"].Value.ToString()); dtblGridDetails.Rows.Add(dr); } } } dtblOtherDetails.Columns.Add("voucherNo"); dtblOtherDetails.Columns.Add("date"); dtblOtherDetails.Columns.Add("totalAmount"); dtblOtherDetails.Columns.Add("ledgerName"); dtblOtherDetails.Columns.Add("Narration"); dtblOtherDetails.Columns.Add("AmountInWords"); dtblOtherDetails.Columns.Add("Declaration"); dtblOtherDetails.Columns.Add("Heading1"); dtblOtherDetails.Columns.Add("Heading2"); dtblOtherDetails.Columns.Add("Heading3"); dtblOtherDetails.Columns.Add("Heading4"); DataRow dRowOther = dtblOtherDetails.Rows[0]; dRowOther["voucherNo"] = txtVoucherNo.Text; dRowOther["date"] = txtDate.Text; dRowOther["totalAmount"] = txtTotal.Text; dRowOther["ledgerName"] = cmbBankorCash.Text; dRowOther["Narration"] = txtNarration.Text; dRowOther["AmountInWords"] = new NumToText().AmountWords(Convert.ToDecimal(txtTotal.Text), PublicVariables._decCurrencyId); dRowOther["address"] = (dtblOtherDetails.Rows[0]["address"].ToString().Replace("\n", ", ")).Replace("\r", ""); VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtblDeclaration = spVoucherType.DeclarationAndHeadingGetByVoucherTypeId(decPaymentVoucherTypeId); dRowOther["Declaration"] = dtblDeclaration.Rows[0]["Declaration"].ToString(); dRowOther["Heading1"] = dtblDeclaration.Rows[0]["Heading1"].ToString(); dRowOther["Heading2"] = dtblDeclaration.Rows[0]["Heading2"].ToString(); dRowOther["Heading3"] = dtblDeclaration.Rows[0]["Heading3"].ToString(); dRowOther["Heading4"] = dtblDeclaration.Rows[0]["Heading4"].ToString(); int inFormId = spVoucherType.FormIdGetForPrinterSettings(Convert.ToInt32(dtblDeclaration.Rows[0]["masterId"].ToString())); PrintWorks.DotMatrixPrint.PrintDesign(inFormId, dtblOtherDetails, dtblGridDetails, dtblOtherDetails); } catch (Exception ex) { MessageBox.Show("PV:11" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function for voucher date /// </summary> public void VoucherDate() { try { dtpDate.MinDate = PublicVariables._dtFromDate; dtpDate.MaxDate = PublicVariables._dtToDate; CompanyInfo infoComapany = new CompanyInfo(); CompanySP spCompany = new CompanySP(); infoComapany = spCompany.CompanyView(1); DateTime dtVoucherDate = infoComapany.CurrentDate; dtpDate.Value = dtVoucherDate; txtDate.Text = dtVoucherDate.ToString("dd-MMM-yyyy"); dtpDate.Value = Convert.ToDateTime(txtDate.Text); txtDate.Focus(); txtDate.SelectAll(); } catch (Exception ex) { MessageBox.Show("SJ:48" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
//, 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(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); //BranchInfo InfoBranch = new BranchInfo(); //BranchSP SpBranch = new BranchSP(); // InfoBranch = SpBranch.BranchView(PublicVariables._branchId); strAddress = dtblCompany.Rows[0].ItemArray[3].ToString().Replace("\r\n", " "); strPhone = dtblCompany.Rows[0].ItemArray[4].ToString(); strName = dtblCompany.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> /// 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(); decimal decCompanyCount = spCompany.CompanyCount(); if (decCompanyCount == 1) { PublicVariables._decCurrentCompanyId = spCompany.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(); decimal decDefaultCompanyId = spCompanyPath.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> /// Function for Edit /// </summary> public void EditFunction() { try { CompanyInfo infoCompany = new CompanyInfo(); CompanySP spCompany = new CompanySP(); CompanyPathInfo infoCompanyPath = new CompanyPathInfo(); CompanyPathSP spCompanyPath = new CompanyPathSP(); UserInfo infoUser = new UserInfo(); UserSP spUser = new UserSP(); 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; 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; infoCompanyPath.CompanyId = 1; infoCompany.CompanyId = 1; infoUser.UserId = PublicVariables._decCurrentUserId; spCompany.CompanyEdit(infoCompany); spCompanyPath.CompanyPathEdit(infoCompanyPath); spUser.UserEdit(infoUser); Messages.UpdatedMessage(); // To set default currencyId...........In exchangeRate..// ExchangeRateSP spExchangeRate = new ExchangeRateSP(); 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; spExchangeRate.ExchangeRateEdit(infoExchangeRate); FinancialYearInfo infoFinancialYear = new FinancialYearInfo(); FinancialYearSP spFinancialYear = new FinancialYearSP(); decimal decIdentity; infoFinancialYear.FromDate = PublicVariables._dtFromDate; infoFinancialYear.ToDate = PublicVariables._dtToDate; infoFinancialYear.ExtraDate = DateTime.Now; infoFinancialYear.Extra1 = string.Empty; infoFinancialYear.Extra2 = string.Empty; bool isExist = spFinancialYear.FinancialYearExistenceCheck(PublicVariables._dtFromDate, PublicVariables._dtToDate); if (!isExist) { decIdentity = spFinancialYear.FinancialYearAddWithReturnIdentity(infoFinancialYear); } //===========Add companyDetails in ExternalDb =====================// decimal decCompanyIdForTemp = PublicVariables._decCurrentCompanyId; PublicVariables._decCurrentCompanyId = 0; CompanySP spExCompany = new CompanySP(); CompanyPathSP spExCompanyPath = new CompanyPathSP(); CompanyInfo infoExCompany = new CompanyInfo(); CompanyPathInfo infoExCompanyPath = new CompanyPathInfo(); infoExCompany = infoCompany; infoExCompanyPath = infoCompanyPath; infoExCompany.CompanyId = decCompanyIdForTemp; infoExCompanyPath.CompanyId = decCompanyIdForTemp; spExCompany.CompanyEdit(infoExCompany); spExCompanyPath.CompanyPathEdit(infoExCompanyPath); PublicVariables._decCurrentCompanyId = decCompanyIdForTemp; this.Close(); } catch (Exception ex) { MessageBox.Show("CR2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }