/// <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);
     }
 }
示例#2
0
 /// <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);
     }
 }
示例#3
0
 /// <summary>
 /// Save or edit function to check the references and invalid entries
 /// </summary>
 public void SaveOrEditFunction()
 {
     try
     {
         FinancialYearInfo infoFinancialYear = new FinancialYearInfo();
         FinancialYearSP   spFinancialYear   = new FinancialYearSP();
         if (PublicVariables.isMessageAdd)
         {
             if (Messages.SaveMessage())
             {
                 if (spFinancialYear.FinancialYearExistenceCheck(Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text)))
                 {
                     SaveFunction();
                 }
                 else
                 {
                     Messages.InformationMessage("Financial year already exist.");
                     txtFromDate.Focus();
                 }
             }
         }
         else
         {
             SaveFunction();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "NFY 3 : " + ex.Message;
     }
 }
示例#4
0
 /// <summary>
 /// Save or edit function to check the references and invalid entries
 /// </summary>
 public void SaveOrEditFunction()
 {
     try
     {
         FinancialYearInfo infoFinancialYear = new FinancialYearInfo();
         FinancialYearSP   spFinancialYear   = new FinancialYearSP();
         if (PublicVariables.isMessageAdd)
         {
             if (Messages.SaveMessage())
             {
                 if (spFinancialYear.FinancialYearExistenceCheck(Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text)))
                 {
                     SaveFunction();
                 }
                 else
                 {
                     Messages.InformationMessage("Financial year already exist.");
                     txtFromDate.Focus();
                 }
             }
         }
         else
         {
             SaveFunction();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("NFY 3 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Function to Fill the grid
        /// </summary>
        public void GridFill()
        {
            try
            {
                FinancialYearSP spFinancialYear = new FinancialYearSP();
                DataTable dtbl = new DataTable();

                dtbl = spFinancialYear.FinancialYearViewAll();
                dgvChangeFinancialYear.DataSource = dtbl;
            }
            catch (Exception ex)
            {
                MessageBox.Show("CHGFINYR:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#6
0
        /// <summary>
        /// Function to Fill the grid
        /// </summary>
        public void GridFill()
        {
            try
            {
                FinancialYearSP spFinancialYear = new FinancialYearSP();
                DataTable       dtbl            = new DataTable();

                dtbl = spFinancialYear.FinancialYearViewAll();
                dgvChangeFinancialYear.DataSource = dtbl;
            }
            catch (Exception ex)
            {
                MessageBox.Show("CHGFINYR:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#7
0
        /// <summary>
        /// Function to Fill the grid
        /// </summary>
        public void GridFill()
        {
            try
            {
                FinancialYearSP spFinancialYear = new FinancialYearSP();
                DataTable       dtbl            = new DataTable();

                dtbl = spFinancialYear.FinancialYearViewAll();
                dgvChangeFinancialYear.DataSource = dtbl;
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "CHGFINYR:1" + ex.Message;
            }
        }
示例#8
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;
            }
            catch (Exception ex)
            {
                MessageBox.Show("SELCMPNY :2 " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#9
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;
            }
            catch (Exception ex)
            {
                formMDI.infoError.ErrorString = "SELCMPNY : 2" + ex.Message;
            }
        }
示例#10
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;

            }
            catch (Exception ex)
            {
                MessageBox.Show("SELCMPNY :2 " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#11
0
 /// <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);
     }
 }
示例#12
0
 /// <summary>
 /// Save or edit function to check the references and invalid entries
 /// </summary>
 public void SaveOrEditFunction()
 {
     try
     {
         FinancialYearInfo infoFinancialYear = new FinancialYearInfo();
         FinancialYearSP spFinancialYear = new FinancialYearSP();
         if (PublicVariables.isMessageAdd)
         {
             if (Messages.SaveMessage())
             {
                 if (spFinancialYear.FinancialYearExistenceCheck(Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text)))
                 {
                     SaveFunction();
                 }
                 else
                 {
                     Messages.InformationMessage("Financial year already exist.");
                     txtFromDate.Focus();
                 }
             }
         }
         else
         {
             SaveFunction();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("NFY 3 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
示例#13
0
 /// <summary>
 /// Function to create new financial year
 /// </summary>
 public void NewFinancialYear()
 {
     FinancialYearSP spFinancialYear = new FinancialYearSP();
     //DateTime dtFromDate = System.DateTime.Now;
     //DateTime dtToDate = System.DateTime.Now;
     DateTime dtFromDate;
     DateTime dtToDate;
     try
     {
         if (frmCompanyCreationObj != null)
         {
             DateTime dtCurrentDate = System.DateTime.Now;
             int inMonth = dtCurrentDate.Month;
             int inYear = dtCurrentDate.Year;
             int inDay = dtCurrentDate.Day;
             if (inMonth < 4 && inDay < 31)
             {
                 string strFromDateDate = "1-Apr-" + (inYear - 1);
                 string strToDate = "31-Mar-" + inYear;
                 dtFromDate = Convert.ToDateTime(strFromDateDate);
                 dtToDate = Convert.ToDateTime(strToDate);
             }
             else
             {
                 string strFromDateDate = "1-Apr-" + inYear;
                 string strToDate = "31-Mar-" + (inYear + 1);
                 dtFromDate = Convert.ToDateTime(strFromDateDate);
                 dtToDate = Convert.ToDateTime(strToDate);
             }
             //dtpFromDate.MinDate = dtFromDate;
             //dtpToDate.MaxDate = dtToDate;
             dtpFromDate.Value = dtFromDate;
             dtpToDate.Value = dtToDate;
             strFromDateToKeep = dtFromDate.ToString("dd-MMM-yyyy");
             strToDateToKeep = dtToDate.ToString("dd-MMM-yyyy");
         }
         else
         {
             string strFromDate = spFinancialYear.FinancialYearGetMax();
             string strToDate = string.Empty;
             dtFromDate = Convert.ToDateTime(strFromDate);
             dtFromDate = dtFromDate.AddDays(1);
             dtpFromDate.Value = dtFromDate;
             txtFromDate.Text = dtFromDate.ToString("dd-MMM-yyyy");
             int inMonth = dtFromDate.Month;
             int inYear = dtFromDate.Year;
             int inDay = dtFromDate.Day;
             if (inMonth >= 4)
             {
                 strToDate = "31-Mar-" + (inYear + 1);
             }
             else
             {
                 strToDate = "31-Mar-" + (inYear);
             }
             dtToDate = Convert.ToDateTime(strToDate);
             dtpToDate.Value = dtToDate;
             txtToDate.Text = dtToDate.ToString("dd-MMM-yyyy");
             //dtpToDate.MaxDate = dtToDate;
             dtpToDate.MinDate = dtFromDate;
             strFromDateToKeep = dtFromDate.ToString("dd-MMM-yyyy");
             strToDateToKeep = dtToDate.ToString("dd-MMM-yyyy");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("NFY 6 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
示例#14
0
 /// <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);
     }
 }
示例#15
0
        /// <summary>
        /// Function to create new financial year
        /// </summary>
        public void NewFinancialYear()
        {
            FinancialYearSP spFinancialYear = new FinancialYearSP();
            //DateTime dtFromDate = System.DateTime.Now;
            //DateTime dtToDate = System.DateTime.Now;
            DateTime dtFromDate;
            DateTime dtToDate;

            try
            {
                if (frmCompanyCreationObj != null)
                {
                    DateTime dtCurrentDate = System.DateTime.Now;
                    int      inMonth       = dtCurrentDate.Month;
                    int      inYear        = dtCurrentDate.Year;
                    int      inDay         = dtCurrentDate.Day;
                    if (inMonth < 4 && inDay < 31)
                    {
                        string strFromDateDate = "1-Apr-" + (inYear - 1);
                        string strToDate       = "31-Mar-" + inYear;
                        dtFromDate = Convert.ToDateTime(strFromDateDate);
                        dtToDate   = Convert.ToDateTime(strToDate);
                    }
                    else
                    {
                        string strFromDateDate = "1-Apr-" + inYear;
                        string strToDate       = "31-Mar-" + (inYear + 1);
                        dtFromDate = Convert.ToDateTime(strFromDateDate);
                        dtToDate   = Convert.ToDateTime(strToDate);
                    }
                    //dtpFromDate.MinDate = dtFromDate;
                    //dtpToDate.MaxDate = dtToDate;
                    dtpFromDate.Value = dtFromDate;
                    dtpToDate.Value   = dtToDate;
                    strFromDateToKeep = dtFromDate.ToString("dd-MMM-yyyy");
                    strToDateToKeep   = dtToDate.ToString("dd-MMM-yyyy");
                }
                else
                {
                    string strFromDate = spFinancialYear.FinancialYearGetMax();
                    string strToDate   = string.Empty;
                    dtFromDate        = Convert.ToDateTime(strFromDate);
                    dtFromDate        = dtFromDate.AddDays(1);
                    dtpFromDate.Value = dtFromDate;
                    txtFromDate.Text  = dtFromDate.ToString("dd-MMM-yyyy");
                    int inMonth = dtFromDate.Month;
                    int inYear  = dtFromDate.Year;
                    int inDay   = dtFromDate.Day;
                    if (inMonth >= 4)
                    {
                        strToDate = "31-Mar-" + (inYear + 1);
                    }
                    else
                    {
                        strToDate = "31-Mar-" + (inYear);
                    }
                    dtToDate        = Convert.ToDateTime(strToDate);
                    dtpToDate.Value = dtToDate;
                    txtToDate.Text  = dtToDate.ToString("dd-MMM-yyyy");
                    //dtpToDate.MaxDate = dtToDate;
                    dtpToDate.MinDate = dtFromDate;
                    strFromDateToKeep = dtFromDate.ToString("dd-MMM-yyyy");
                    strToDateToKeep   = dtToDate.ToString("dd-MMM-yyyy");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("NFY 6 : " + 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);
            }
        }
示例#17
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);
     }
 }
示例#18
0
 /// <summary>
 /// Function to update values in ledgerposting table
 /// </summary>
 public void ledgerUpdate()
 {
     try
     {
         string strfinancialId;
         FinancialYearSP spFinancialYear = new FinancialYearSP();
         FinancialYearInfo infoFinancialYear = new FinancialYearInfo();
         infoFinancialYear = spFinancialYear.FinancialYearViewForAccountLedger(1);
         strfinancialId = infoFinancialYear.FromDate.ToString("dd-MMM-yyyy");
         decimal decLedgerPostingId = 0;
         if (txtOpeningBalance.Text.Trim() != string.Empty)
         {
             decOpeningBlnc = Convert.ToDecimal(txtOpeningBalance.Text.Trim());
         }
         else
         {
             decOpeningBlnc = 0;
         }
         LedgerPostingSP spLedgerPosting = new LedgerPostingSP();
         LedgerPostingInfo infoLedgerPosting = new LedgerPostingInfo();
         DataTable dtbl = spLedgerPosting.GetLedgerPostingIds(decLedgerIdForEdit.ToString(), 1);
         foreach (DataRow dr in dtbl.Rows)
         {
             decLedgerPostingId = Convert.ToDecimal(dr.ItemArray[0].ToString());
         }
         if (cmbDrorCr.Text == "Dr")
         {
             infoLedgerPosting.Debit = decOpeningBlnc;
         }
         else
         {
             infoLedgerPosting.Credit = decOpeningBlnc;
         }
         infoLedgerPosting.LedgerPostingId = decLedgerPostingId;
         infoLedgerPosting.VoucherTypeId = 1;
         infoLedgerPosting.VoucherNo = decLedgerIdForEdit.ToString();
         infoLedgerPosting.Date = Convert.ToDateTime(strfinancialId.ToString());
         infoLedgerPosting.LedgerId = decLedgerIdForEdit;
         infoLedgerPosting.DetailsId = 0;
         infoLedgerPosting.InvoiceNo = decLedgerIdForEdit.ToString();
         infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId;
         infoLedgerPosting.ChequeDate = DateTime.Now;
         infoLedgerPosting.ChequeNo = string.Empty;
         infoLedgerPosting.Extra1 = string.Empty;
         infoLedgerPosting.Extra2 = string.Empty;
         if (dtbl.Rows.Count > 0)
         {
             if (decOpeningBlnc > 0)
             {
                 spLedgerPosting.LedgerPostingEdit(infoLedgerPosting);
             }
             else
             {
                 AccountLedgerSP spAccountLedger = new AccountLedgerSP();
                 spAccountLedger.LedgerPostingDeleteByVoucherTypeAndVoucherNo(decLedgerIdForEdit.ToString(), 1);
             }
         }
         else
         {
             spLedgerPosting.LedgerPostingAdd(infoLedgerPosting);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Cus16:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
示例#19
0
 /// <summary>
 /// Function to save values to ledgerposting table
 /// </summary>
 public void ledgerPosting()
 {
     try
     {
         string strfinancialId;
         decOpeningBlnc = Convert.ToDecimal(txtOpeningBalance.Text);
         LedgerPostingSP spLedgerPosting = new LedgerPostingSP();
         LedgerPostingInfo infoLedgerPosting = new LedgerPostingInfo();
         FinancialYearSP spFinancialYear = new FinancialYearSP();
         FinancialYearInfo infoFinancialYear = new FinancialYearInfo();
         infoFinancialYear = spFinancialYear.FinancialYearViewForAccountLedger(1);
         strfinancialId = infoFinancialYear.FromDate.ToString("dd-MMM-yyyy");
         if (cmbDrorCr.Text == "Dr")
         {
             infoLedgerPosting.Debit = decOpeningBlnc;
         }
         else
         {
             infoLedgerPosting.Credit = decOpeningBlnc;
         }
         infoLedgerPosting.VoucherTypeId = 1;
         infoLedgerPosting.VoucherNo = decledgerid.ToString();
         infoLedgerPosting.Date = Convert.ToDateTime(strfinancialId.ToString());
         infoLedgerPosting.LedgerId = decledgerid;
         infoLedgerPosting.DetailsId = 0;
         infoLedgerPosting.InvoiceNo = decledgerid.ToString();
         infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId;
         infoLedgerPosting.ChequeDate = DateTime.Now;
         infoLedgerPosting.ChequeNo = string.Empty;
         infoLedgerPosting.Extra1 = string.Empty;
         infoLedgerPosting.Extra2 = string.Empty;
         spLedgerPosting.LedgerPostingAdd(infoLedgerPosting);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Cus14:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
示例#20
0
        /// <summary>
        /// Save data to the database
        /// </summary>
        public void SaveFunction()
        {
            try
            {
                int               inRowcount        = dgvMultipleAccountLedger.RowCount;//edited by Runali
                int               inRowcountDec     = (dgvMultipleAccountLedger.RowCount) - 1;
                decimal           decOpeningBalance = 0;
                decimal           decLedgerId       = 0;
                bool              isSave            = false;
                AccountLedgerInfo infoAccountledger = new AccountLedgerInfo();
                AccountLedgerSP   spAccountledger   = new AccountLedgerSP();
                LedgerPostingSP   spLedgerPosting   = new LedgerPostingSP();
                LedgerPostingInfo infoLedgerPosting = new LedgerPostingInfo();
                FinancialYearSP   spFinancialYear   = new FinancialYearSP();
                FinancialYearInfo infoFinancialYear = new FinancialYearInfo();

                for (int i = 0; i < inRowcount - 1; i++)
                {
                    infoAccountledger.AccountGroupId = Convert.ToDecimal(cmbAccountGroup.SelectedValue.ToString());

                    infoAccountledger.LedgerName = dgvMultipleAccountLedger.Rows[i].Cells["dgvtxtLedgerName"].Value.ToString();
                    if (dgvMultipleAccountLedger.Rows[i].Cells["dgvtxtOpeningBalance"].Value != null)
                    {
                        infoAccountledger.OpeningBalance = Convert.ToDecimal(dgvMultipleAccountLedger.Rows[i].Cells["dgvtxtOpeningBalance"].Value.ToString());
                    }
                    else
                    {
                        infoAccountledger.OpeningBalance = 0;
                    }
                    infoAccountledger.CrOrDr = dgvMultipleAccountLedger.Rows[i].Cells["dgvcmbDebitOrCredit"].Value.ToString();

                    if (dgvMultipleAccountLedger.Rows[i].Cells["dgvtxtNarration"].Value != null)
                    {
                        infoAccountledger.Narration = dgvMultipleAccountLedger.Rows[i].Cells["dgvtxtNarration"].Value.ToString();
                    }
                    else
                    {
                        infoAccountledger.Narration = string.Empty;
                    }
                    infoAccountledger.MailingName       = string.Empty;
                    infoAccountledger.Address           = string.Empty;
                    infoAccountledger.State             = string.Empty;
                    infoAccountledger.Phone             = string.Empty;
                    infoAccountledger.Mobile            = string.Empty;
                    infoAccountledger.Email             = string.Empty;
                    infoAccountledger.CreditPeriod      = 0;
                    infoAccountledger.CreditLimit       = 0;
                    infoAccountledger.PricinglevelId    = 0;
                    infoAccountledger.BillByBill        = false;
                    infoAccountledger.Tin               = string.Empty;
                    infoAccountledger.Cst               = string.Empty;
                    infoAccountledger.Pan               = string.Empty;
                    infoAccountledger.RouteId           = 0;
                    infoAccountledger.BankAccountNumber = string.Empty;
                    infoAccountledger.BranchName        = string.Empty;
                    infoAccountledger.BranchCode        = string.Empty;
                    infoAccountledger.Extra1            = string.Empty;
                    infoAccountledger.Extra2            = string.Empty;
                    infoAccountledger.AreaId            = 0;
                    infoAccountledger.IsDefault         = false;
                    decLedgerId = spAccountledger.AccountLedgerAddWithIdentity(infoAccountledger);

                    if (dgvMultipleAccountLedger.Rows[i].Cells["dgvtxtOpeningBalance"].Value != null && dgvMultipleAccountLedger.Rows[i].Cells["dgvtxtOpeningBalance"].Value.ToString() != "0")
                    {
                        if (dgvMultipleAccountLedger.Rows[i].Cells["dgvtxtOpeningBalance"].Value.ToString() != string.Empty)
                        {
                            string strfinancialId;
                            decOpeningBalance = Convert.ToDecimal(dgvMultipleAccountLedger.Rows[i].Cells["dgvtxtOpeningBalance"].Value.ToString());
                            infoFinancialYear = spFinancialYear.FinancialYearViewForAccountLedger(1);
                            strfinancialId    = infoFinancialYear.FromDate.ToString("dd-MMM-yyyy");
                            infoLedgerPosting.VoucherTypeId = 1;
                            infoLedgerPosting.Date          = Convert.ToDateTime(strfinancialId.ToString());
                            infoLedgerPosting.LedgerId      = decLedgerId;
                            infoLedgerPosting.VoucherNo     = decLedgerId.ToString();
                            if (dgvMultipleAccountLedger.Rows[i].Cells["dgvcmbDebitOrCredit"].Value.ToString() == "Dr")
                            {
                                infoLedgerPosting.Debit = decOpeningBalance;
                            }
                            else
                            {
                                infoLedgerPosting.Credit = decOpeningBalance;
                            }
                            infoLedgerPosting.DetailsId = 0;
                            infoLedgerPosting.YearId    = PublicVariables._decCurrentFinancialYearId;
                            infoLedgerPosting.InvoiceNo = decLedgerId.ToString();

                            infoLedgerPosting.ChequeNo   = string.Empty;
                            infoLedgerPosting.ChequeDate = DateTime.Now;

                            infoLedgerPosting.Extra1 = string.Empty;
                            infoLedgerPosting.Extra2 = string.Empty;
                            spLedgerPosting.LedgerPostingAdd(infoLedgerPosting);
                        }
                    }
                    isSave = true;
                }
                if (isSave)
                {
                    Messages.SavedMessage();
                    cmbAccountGroup.Focus();
                    cmbAccountGroup.SelectedIndex = -1;
                    dgvMultipleAccountLedger.Rows.Clear();
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("MAL6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// Save data to the database
        /// </summary>
        public void SaveFunction()
        {
            try
            {
                int inRowcount = dgvMultipleAccountLedger.RowCount;//edited by Runali
                int inRowcountDec = (dgvMultipleAccountLedger.RowCount) - 1;
                decimal decOpeningBalance = 0;
                decimal decLedgerId = 0;
                bool isSave = false;
                AccountLedgerInfo infoAccountledger = new AccountLedgerInfo();
                AccountLedgerSP spAccountledger = new AccountLedgerSP();
                LedgerPostingSP spLedgerPosting = new LedgerPostingSP();
                LedgerPostingInfo infoLedgerPosting = new LedgerPostingInfo();
                FinancialYearSP spFinancialYear = new FinancialYearSP();
                FinancialYearInfo infoFinancialYear = new FinancialYearInfo();

                for (int i = 0; i < inRowcount - 1; i++)
                {
                    infoAccountledger.AccountGroupId = Convert.ToDecimal(cmbAccountGroup.SelectedValue.ToString());

                    infoAccountledger.LedgerName = dgvMultipleAccountLedger.Rows[i].Cells["dgvtxtLedgerName"].Value.ToString();
                    if (dgvMultipleAccountLedger.Rows[i].Cells["dgvtxtOpeningBalance"].Value != null)
                    {
                        infoAccountledger.OpeningBalance = Convert.ToDecimal(dgvMultipleAccountLedger.Rows[i].Cells["dgvtxtOpeningBalance"].Value.ToString());
                    }
                    else
                    {
                        infoAccountledger.OpeningBalance = 0;
                    }
                    infoAccountledger.CrOrDr = dgvMultipleAccountLedger.Rows[i].Cells["dgvcmbDebitOrCredit"].Value.ToString();

                    if (dgvMultipleAccountLedger.Rows[i].Cells["dgvtxtNarration"].Value != null)
                    {
                        infoAccountledger.Narration = dgvMultipleAccountLedger.Rows[i].Cells["dgvtxtNarration"].Value.ToString();
                    }
                    else
                    {
                        infoAccountledger.Narration = string.Empty;
                    }
                    infoAccountledger.MailingName = string.Empty;
                    infoAccountledger.Address = string.Empty;
                    infoAccountledger.State = string.Empty;
                    infoAccountledger.Phone = string.Empty;
                    infoAccountledger.Mobile = string.Empty;
                    infoAccountledger.Email = string.Empty;
                    infoAccountledger.CreditPeriod = 0;
                    infoAccountledger.CreditLimit = 0;
                    infoAccountledger.PricinglevelId = 0;
                    infoAccountledger.BillByBill = false;
                    infoAccountledger.Tin = string.Empty;
                    infoAccountledger.Cst = string.Empty;
                    infoAccountledger.Pan = string.Empty;
                    infoAccountledger.RouteId = 0;
                    infoAccountledger.BankAccountNumber = string.Empty;
                    infoAccountledger.BranchName = string.Empty;
                    infoAccountledger.BranchCode = string.Empty;
                    infoAccountledger.Extra1 = string.Empty;
                    infoAccountledger.Extra2 = string.Empty;
                    infoAccountledger.AreaId = 0;
                    infoAccountledger.IsDefault = false;
                    decLedgerId = spAccountledger.AccountLedgerAddWithIdentity(infoAccountledger);

                    if (dgvMultipleAccountLedger.Rows[i].Cells["dgvtxtOpeningBalance"].Value != null && dgvMultipleAccountLedger.Rows[i].Cells["dgvtxtOpeningBalance"].Value.ToString() != "0")
                    {
                        if (dgvMultipleAccountLedger.Rows[i].Cells["dgvtxtOpeningBalance"].Value.ToString() != string.Empty)
                        {
                            string strfinancialId;
                            decOpeningBalance = Convert.ToDecimal(dgvMultipleAccountLedger.Rows[i].Cells["dgvtxtOpeningBalance"].Value.ToString());
                            infoFinancialYear = spFinancialYear.FinancialYearViewForAccountLedger(1);
                            strfinancialId = infoFinancialYear.FromDate.ToString("dd-MMM-yyyy");
                            infoLedgerPosting.VoucherTypeId = 1;
                            infoLedgerPosting.Date = Convert.ToDateTime(strfinancialId.ToString());
                            infoLedgerPosting.LedgerId = decLedgerId;
                            infoLedgerPosting.VoucherNo = decLedgerId.ToString();
                            if (dgvMultipleAccountLedger.Rows[i].Cells["dgvcmbDebitOrCredit"].Value.ToString() == "Dr")
                            {
                                infoLedgerPosting.Debit = decOpeningBalance;
                            }
                            else
                            {
                                infoLedgerPosting.Credit = decOpeningBalance;
                            }
                            infoLedgerPosting.DetailsId = 0;
                            infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId;
                            infoLedgerPosting.InvoiceNo = decLedgerId.ToString();

                            infoLedgerPosting.ChequeNo = string.Empty;
                            infoLedgerPosting.ChequeDate = DateTime.Now;

                            infoLedgerPosting.Extra1 = string.Empty;
                            infoLedgerPosting.Extra2 = string.Empty;
                            spLedgerPosting.LedgerPostingAdd(infoLedgerPosting);

                        }

                    }
                    isSave = true;
                }
                if (isSave)
                {
                    Messages.SavedMessage();
                    cmbAccountGroup.Focus();
                    cmbAccountGroup.SelectedIndex = -1;
                    dgvMultipleAccountLedger.Rows.Clear();
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("MAL6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }