Beispiel #1
0
 /// <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>
 /// 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);
     }
 }
Beispiel #3
0
 /// <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 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 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 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);
            }
        }
Beispiel #8
0
 /// <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);
     }
 }
 /// <summary>
 /// Setting the check box Status
 /// </summary>
 public void FillSettings()
 {
     try
     {
         BarcodeSettingsInfo Info = new BarcodeSettingsSP().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();
             InfoCompany = Sp.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);
     }
 }
 /// <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 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>
 /// 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 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);
     }
 }
 /// <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);
     }
 }
Beispiel #15
0
 /// <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>
        /// 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);
            }
        }
Beispiel #17
0
 /// <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();
         infoComapany = spCompany.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();
         }
         SettingsSP spSettings = new SettingsSP();
         if (spSettings.SettingsStatusCheck("TickPrintAfterSave") == "Yes")
         {
             cbxPrintafterSave.Checked = true;
         }
         else
         {
             cbxPrintafterSave.Checked = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("CV:09" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #18
0
        /// <summary>
        /// Function to insert values to Company Table
        /// </summary>
        /// <param name="companyinfo"></param>
        /// <returns></returns>
        public decimal CompanyAddParticularFeilds(CompanyInfo companyinfo)
        {
            decimal decCopmanyId = 0;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("CompanyAddParticularFeilds", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@companyName", SqlDbType.VarChar);
                sprmparam.Value = companyinfo.CompanyName;
                sprmparam       = sccmd.Parameters.Add("@mailingName", SqlDbType.VarChar);
                sprmparam.Value = companyinfo.MailingName;
                sprmparam       = sccmd.Parameters.Add("@address", SqlDbType.VarChar);
                sprmparam.Value = companyinfo.Address;
                sprmparam       = sccmd.Parameters.Add("@phone", SqlDbType.VarChar);
                sprmparam.Value = companyinfo.Phone;
                sprmparam       = sccmd.Parameters.Add("@mobile", SqlDbType.VarChar);
                sprmparam.Value = companyinfo.Mobile;
                sprmparam       = sccmd.Parameters.Add("@emailId", SqlDbType.VarChar);
                sprmparam.Value = companyinfo.EmailId;
                sprmparam       = sccmd.Parameters.Add("@web", SqlDbType.VarChar);
                sprmparam.Value = companyinfo.Web;
                sprmparam       = sccmd.Parameters.Add("@country", SqlDbType.VarChar);
                sprmparam.Value = companyinfo.Country;
                sprmparam       = sccmd.Parameters.Add("@state", SqlDbType.VarChar);
                sprmparam.Value = companyinfo.State;
                sprmparam       = sccmd.Parameters.Add("@pin", SqlDbType.VarChar);
                sprmparam.Value = companyinfo.Pin;
                sprmparam       = sccmd.Parameters.Add("@currencyId", SqlDbType.Decimal);
                sprmparam.Value = companyinfo.CurrencyId;
                sprmparam       = sccmd.Parameters.Add("@financialYearFrom", SqlDbType.DateTime);
                sprmparam.Value = companyinfo.FinancialYearFrom;
                sprmparam       = sccmd.Parameters.Add("@booksBeginingFrom", SqlDbType.DateTime);
                sprmparam.Value = companyinfo.BooksBeginingFrom;
                sprmparam       = sccmd.Parameters.Add("@tin", SqlDbType.VarChar);
                sprmparam.Value = companyinfo.Tin;
                sprmparam       = sccmd.Parameters.Add("@cst", SqlDbType.VarChar);
                sprmparam.Value = companyinfo.Cst;
                sprmparam       = sccmd.Parameters.Add("@pan", SqlDbType.VarChar);
                sprmparam.Value = companyinfo.Pan;
                sprmparam       = sccmd.Parameters.Add("@currentDate", SqlDbType.DateTime);
                sprmparam.Value = companyinfo.CurrentDate;
                sprmparam       = sccmd.Parameters.Add("@logo", SqlDbType.Image);
                sprmparam.Value = companyinfo.Logo;
                sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value = companyinfo.Extra1;
                sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value = companyinfo.Extra2;
                decCopmanyId    = Convert.ToDecimal(sccmd.ExecuteScalar().ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(decCopmanyId);
        }
Beispiel #19
0
 /// <summary>
 /// Setting the check box Status
 /// </summary>
 public void FillSettings()
 {
     try
     {
         BarcodeSettingsInfo Info = new BarcodeSettingsSP().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();
             InfoCompany             = Sp.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);
     }
 }
Beispiel #20
0
 /// <summary>
 /// Function to Update values in Company Table
 /// </summary>
 /// <param name="companyinfo"></param>
 public void CompanyEdit(CompanyInfo companyinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("CompanyEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@companyId", SqlDbType.Decimal);
         sprmparam.Value = companyinfo.CompanyId;
         sprmparam = sccmd.Parameters.Add("@companyName", SqlDbType.VarChar);
         sprmparam.Value = companyinfo.CompanyName;
         sprmparam = sccmd.Parameters.Add("@mailingName", SqlDbType.VarChar);
         sprmparam.Value = companyinfo.MailingName;
         sprmparam = sccmd.Parameters.Add("@address", SqlDbType.VarChar);
         sprmparam.Value = companyinfo.Address;
         sprmparam = sccmd.Parameters.Add("@phone", SqlDbType.VarChar);
         sprmparam.Value = companyinfo.Phone;
         sprmparam = sccmd.Parameters.Add("@mobile", SqlDbType.VarChar);
         sprmparam.Value = companyinfo.Mobile;
         sprmparam = sccmd.Parameters.Add("@emailId", SqlDbType.VarChar);
         sprmparam.Value = companyinfo.EmailId;
         sprmparam = sccmd.Parameters.Add("@web", SqlDbType.VarChar);
         sprmparam.Value = companyinfo.Web;
         sprmparam = sccmd.Parameters.Add("@country", SqlDbType.VarChar);
         sprmparam.Value = companyinfo.Country;
         sprmparam = sccmd.Parameters.Add("@state", SqlDbType.VarChar);
         sprmparam.Value = companyinfo.State;
         sprmparam = sccmd.Parameters.Add("@pin", SqlDbType.VarChar);
         sprmparam.Value = companyinfo.Pin;
         sprmparam = sccmd.Parameters.Add("@currencyId", SqlDbType.Decimal);
         sprmparam.Value = companyinfo.CurrencyId;
         sprmparam = sccmd.Parameters.Add("@financialYearFrom", SqlDbType.DateTime);
         sprmparam.Value = companyinfo.FinancialYearFrom;
         sprmparam = sccmd.Parameters.Add("@booksBeginingFrom", SqlDbType.DateTime);
         sprmparam.Value = companyinfo.BooksBeginingFrom;
         sprmparam = sccmd.Parameters.Add("@tin", SqlDbType.VarChar);
         sprmparam.Value = companyinfo.Tin;
         sprmparam = sccmd.Parameters.Add("@cst", SqlDbType.VarChar);
         sprmparam.Value = companyinfo.Cst;
         sprmparam = sccmd.Parameters.Add("@pan", SqlDbType.VarChar);
         sprmparam.Value = companyinfo.Pan;
         sprmparam = sccmd.Parameters.Add("@currentDate", SqlDbType.DateTime);
         sprmparam.Value = companyinfo.CurrentDate;
         sprmparam = sccmd.Parameters.Add("@logo", SqlDbType.Image);
         sprmparam.Value = companyinfo.Logo;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = companyinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = companyinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
Beispiel #21
0
 /// <summary>
 /// Function to get particular values from Company table based on the parameter
 /// </summary>
 /// <param name="companyId"></param>
 /// <returns></returns>
 public CompanyInfo CompanyView(decimal companyId)
 {
     CompanyInfo companyinfo = new CompanyInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("CompanyView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@companyId", SqlDbType.Decimal);
         sprmparam.Value = companyId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             companyinfo.CompanyId = decimal.Parse(sdrreader[0].ToString());
             companyinfo.CompanyName = sdrreader[1].ToString();
             companyinfo.MailingName = sdrreader[2].ToString();
             companyinfo.Address = sdrreader[3].ToString();
             companyinfo.Phone = sdrreader[4].ToString();
             companyinfo.Mobile = sdrreader[5].ToString();
             companyinfo.EmailId = sdrreader[6].ToString();
             companyinfo.Web = sdrreader[7].ToString();
             companyinfo.Country = sdrreader[8].ToString();
             companyinfo.State = sdrreader[9].ToString();
             companyinfo.Pin = sdrreader[10].ToString();
             companyinfo.CurrencyId = decimal.Parse(sdrreader[11].ToString());
             companyinfo.FinancialYearFrom = DateTime.Parse(sdrreader[12].ToString());
             companyinfo.BooksBeginingFrom = DateTime.Parse(sdrreader[13].ToString());
             companyinfo.Tin = sdrreader[14].ToString();
             companyinfo.Cst = sdrreader[15].ToString();
             companyinfo.Pan = sdrreader[16].ToString();
             companyinfo.CurrentDate = DateTime.Parse(sdrreader[17].ToString());
             companyinfo.Logo = (byte[])(sdrreader[18]);
             companyinfo.Extra1 = sdrreader[19].ToString();
             companyinfo.Extra2 = sdrreader[20].ToString();
             companyinfo.ExtraDate = DateTime.Parse(sdrreader[21].ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return companyinfo;
 }