/// <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 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);
     }
 }
 /// <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);
     }
 }
        /// <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);

            }
        }
Ejemplo n.º 5
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 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>
        /// 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();
                    FinancialYearBll bllFinancialYear = new FinancialYearBll();
                    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();
                    CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
                    bllCompanyCreation.CompanyCurrentDateEdit(dtmFromDate);
                    if (dtGetCurrentdate < dtmFromDate)
                    {
                        PublicVariables._dtCurrentDate = dtmFromDate;
                        bllCompanyCreation.CompanyCurrentDateEdit(dtmFromDate);
                        formMDI.MDIObj.ShowCurrentDate();
                    }
                    else
                    {

                        PublicVariables._dtCurrentDate = dtGetCurrentdate;
                        bllCompanyCreation.CompanyCurrentDateEdit(dtmFromDate);
                        formMDI.MDIObj.ShowCurrentDate();
                    }
                    CompanyInfo infoCompany = new CompanyInfo();
                    infoCompany = bllCompanyCreation.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);
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Start a login
 /// </summary>
 public void Login()
 {
     try
     {
         UserBll bllUser = new UserBll();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         CompanyInfo infoCompany = new CompanyInfo();
         string strUserName = txtUserName.Text.Trim();
         string strPassword = bllUser.LoginCheck(strUserName);
         if (strPassword == txtPassword.Text.Trim() && strPassword != string.Empty)
         {
             int inUserId = bllUser.GetUserIdAfterLogin(strUserName, strPassword);
             PublicVariables._decCurrentUserId = inUserId;
             infoCompany = bllCompanyCreation.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>
 /// 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();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         infoComapany = bllCompanyCreation.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();
                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;

            }
            catch (Exception ex)
            {
                MessageBox.Show("SELCMPNY :2 " + 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();
         CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
         CompanyInfo infoCompany = new CompanyInfo();
         infoCompany = bllCompanyCreation.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>
 /// Setting the check box Status
 /// </summary>
 public void FillSettings()
 {
     try
     {
         BarcodeSettingsInfo Info = new BarcodeSettingsBll().BarcodeSettingsView(1);
         if (Info.ShowMRP == true)
         {
             cbxShowMrp.Checked = true;
         }
         else
         {
             cbxShowMrp.Checked = false;
         }
         if (Info.ShowProductCode == true)
         {
             rbtnShowProductCode.Checked = true;
         }
         else
         {
             rbtnShowProductName.Checked = true;
         }
         if (Info.ShowCompanyName == true)
         {
             cbxShowCompanyNAmeAs.Checked = true;
         }
         else
         {
             cbxShowCompanyNAmeAs.Checked = false;
         }
         if (Info.ShowPurchaseRate == true)
         {
             cbxShowPurchaseRate.Checked = true;
         }
         else
         {
             cbxShowPurchaseRate.Checked = false;
         }
         txtShowCompanyName.Text = Info.CompanyName;
         if (txtShowCompanyName.Text == string.Empty)
         {
             CompanyInfo InfoCompany = new CompanyInfo();
             //CompanySP Sp = new CompanySP();
             CompanyCreationBll Bll = new CompanyCreationBll();
             InfoCompany = Bll.CompanyView(1);
             txtShowCompanyName.Text = InfoCompany.CompanyName;
         }
         txtZero.Text = Info.Zero;
         txtOne.Text = Info.One;
         txtTwo.Text = Info.Two;
         txtThree.Text = Info.Three;
         txtFour.Text = Info.Four;
         txtFive.Text = Info.Five;
         txtSix.Text = Info.Six;
         txtSeven.Text = Info.Seven;
         txtEight.Text = Info.Eight;
         txtNine.Text = Info.Nine;
         txtPoint.Text = Info.Point;
     }
     catch (Exception ex)
     {
         MessageBox.Show("BS4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }