示例#1
0
        /// <summary>
        /// Function to get all vouchers based on parameters
        /// </summary>
        /// <param name="strVoucherType"></param>
        /// <returns></returns>
        public List <DataTable> cVoucherTypeSelectionComboFill(string strVoucherType)
        {
            List <DataTable> listObj = new List <DataTable>();

            try
            {
                listObj = spVoucherType.VoucherTypeSelectionComboFill(strVoucherType);
            }
            catch (Exception ex)
            {
                MessageBox.Show("VT4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(listObj);
        }
示例#2
0
 /// <summary>
 /// Function to check the voucher type and fill the corresponding vouchertype in VoucherType combobox
 /// </summary>
 /// <param name="strVoucherType"></param>
 public void CallFromVoucherMenu(string strVoucherType)
 {
     try
     {
         if (formMDI.strVouchertype == "POS")
         {
             VoucherType = "POS";
         }
         else
         {
             VoucherType = strVoucherType;
         }
         VoucherTypeSP spVoucherType   = new VoucherTypeSP();
         DataTable     dtblVouchetType = new DataTable();
         dtblVouchetType = spVoucherType.VoucherTypeSelectionComboFill(strVoucherType);
         int inCount = dtblVouchetType.Rows.Count;
         cmbVoucherType.DataSource    = dtblVouchetType;
         cmbVoucherType.ValueMember   = "voucherTypeId";
         cmbVoucherType.DisplayMember = "voucherTypeName";
         cmbVoucherType.SelectedIndex = -1;
         if (inCount == 1)
         {
             cmbVoucherType.SelectedValue = dtblVouchetType.Rows[0].ItemArray[0].ToString();
             btnGo_Click(btnGo, EventArgs.Empty);
         }
         else
         {
             base.Show();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("VTS1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
示例#3
0
        public void CallFromVoucherTypeSelection()
        {
            VoucherTypeSP spVoucherType   = new VoucherTypeSP();
            DataTable     dtblVouchetType = new DataTable();

            dtblVouchetType = spVoucherType.VoucherTypeSelectionComboFill(strVoucherType);
            decimal decVoucherTypeId = (decimal)dtblVouchetType.Rows[0][0];

            decPaymentVoucherTypeId = decVoucherTypeId;
            strPaymentVoucherTypeId = decVoucherTypeId.ToString();

            isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(Convert.ToDecimal(decVoucherTypeId.ToString()));
            SuffixPrefixSP   spSuffisprefix   = new SuffixPrefixSP();
            SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo();

            infoSuffixPrefix         = spSuffisprefix.GetSuffixPrefixDetails(Convert.ToDecimal(strPaymentVoucherTypeId), dtpDate);
            decPaymentSuffixPrefixId = infoSuffixPrefix.SuffixprefixId;
        }
示例#4
0
        public ActionResult GetDailySalaryVoucherForModal(string salaryDate)
        {
            bool   isSuccess    = true;
            string message      = string.Empty;
            string jsonResult   = string.Empty;
            string jsonCombo    = string.Empty;
            string strVoucherNo = string.Empty;
            string strTableName = "DailySalaryVoucherMaster";

            try
            {
                VoucherTypeSP spVoucherType   = new VoucherTypeSP();
                DataTable     dtblVouchetType = new DataTable();
                dtblVouchetType = spVoucherType.VoucherTypeSelectionComboFill("Daily Salary Voucher");
                int    inCount     = dtblVouchetType.Rows.Count;
                string voucherType = string.Empty;
                if (inCount == 1)
                {
                    voucherType = dtblVouchetType.Rows[0].ItemArray[0].ToString();
                    decimal decDailyVoucherTypeId = decimal.Parse(voucherType);

                    TransactionsGeneralFill    TransactionsGeneralFillobj = new TransactionsGeneralFill();
                    DailySalaryVoucherMasterSP spmaster = new DailySalaryVoucherMasterSP();
                    strVoucherNo = spmaster.SalaryVoucherMasterGetMaxPlusOne(decDailyVoucherTypeId).ToString();
                    strVoucherNo = TransactionsGeneralFillobj.VoucherNumberAutomaicGeneration(decDailyVoucherTypeId, Convert.ToDecimal(strVoucherNo), Convert.ToDateTime(salaryDate), strTableName);
                }

                DataTable dtbl = DailySalaryVoucherDetailsGridfill(false, "0", salaryDate);
                jsonResult = Utils.ConvertDataTabletoString(dtbl);

                DailySalaryVoucherMasterSP spMaster = new DailySalaryVoucherMasterSP();
                DataTable newDtbl = new DataTable();
                newDtbl   = spMaster.DailySalaryVoucherCashOrBankLedgersComboFill();
                jsonCombo = Utils.ConvertDataTabletoString(newDtbl);
            }
            catch (Exception ex)
            {
                isSuccess = false;
                message   = ex.Message;
            }
            return(Json(new { isSuccess, message, voucherNo = strVoucherNo, data = jsonResult, jsonCombo }));
        }
示例#5
0
 /// <summary>
 /// Function to fill VoucherType combobox
 /// </summary>
 public void VoucherTypeComboFill()
 {
     try
     {
         DataTable dtblVoucher = new DataTable();
         dtblVoucher = spVoucherType.VoucherTypeSelectionComboFill("Delivery Note");
         cmbVoucherType.DataSource = dtblVoucher;
         DataRow drawselect = dtblVoucher.NewRow();
         drawselect["voucherTypeId"]   = 0;
         drawselect["voucherTypeName"] = "All";
         dtblVoucher.Rows.InsertAt(drawselect, 0);
         cmbVoucherType.ValueMember   = "voucherTypeId";
         cmbVoucherType.DisplayMember = "voucherTypeName";
         cmbVoucherType.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show("DNREP01" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
示例#6
0
 /// <summary>
 /// Function to fill VoucherType combobox
 /// </summary>
 public void VoucherTypeComboFill()
 {
     try
     {
         VoucherTypeSP spVoucherType   = new VoucherTypeSP();
         DataTable     dtblVouchetType = new DataTable();
         dtblVouchetType = spVoucherType.VoucherTypeSelectionComboFill("Contra Voucher");
         DataRow dr = dtblVouchetType.NewRow();
         dr[1] = "ALL";
         dtblVouchetType.Rows.InsertAt(dr, 0);
         cmbVoucherType.DataSource    = dtblVouchetType;
         cmbVoucherType.ValueMember   = "voucherTypeId";
         cmbVoucherType.DisplayMember = "voucherTypeName";
         cmbVoucherType.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show("CRT:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
示例#7
0
        /// <summary>
        /// Function to fill VoucherType combobox
        /// </summary>
        public void VoucherTypeComboFill()
        {
            VoucherTypeSP spVoucherType = new VoucherTypeSP();
            DataTable     dtbl          = new DataTable();

            try
            {
                dtbl = spVoucherType.VoucherTypeSelectionComboFill("Purchase Invoice");
                DataRow drow = dtbl.NewRow();
                drow["voucherTypeId"]   = 0;
                drow["voucherTypeName"] = "All";
                dtbl.Rows.InsertAt(drow, 0);
                cmbVoucherType.DataSource    = dtbl;
                cmbVoucherType.ValueMember   = "voucherTypeId";
                cmbVoucherType.DisplayMember = "voucherTypeName";
            }
            catch (Exception ex)
            {
                MessageBox.Show("PIREP3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#8
0
 /// <summary>
 /// Function to fill VoucherType combobox
 /// </summary>
 public void VoucherTypeComboFill()
 {
     try
     {
         DataTable     dtblVoucherTypes = new DataTable();
         VoucherTypeSP spVoucherType    = new VoucherTypeSP();
         dtblVoucherTypes = spVoucherType.VoucherTypeSelectionComboFill("Service Voucher");
         DataRow dr = dtblVoucherTypes.NewRow();
         dr["voucherTypeId"]   = 0;
         dr["voucherTypeName"] = "All";
         dtblVoucherTypes.Rows.InsertAt(dr, 0);
         cmbVoucherType.DataSource    = dtblVoucherTypes;
         cmbVoucherType.DisplayMember = "voucherTypeName";
         cmbVoucherType.ValueMember   = "voucherTypeId";
         cmbVoucherType.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show("SVRT 6 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
示例#9
0
 /// <summary>
 /// Function to fill VoucherType combobox
 /// </summary>
 public void VoucherTypeFill()
 {
     try
     {
         VoucherTypeSP spVoucherType = new VoucherTypeSP();
         DataTable     dtbl          = new DataTable();
         dtbl = spVoucherType.VoucherTypeSelectionComboFill("Physical Stock");
         DataRow dr = dtbl.NewRow();
         dr[0] = 0;
         dr[1] = "All";
         dtbl.Rows.InsertAt(dr, 0);
         cmbVoucherType.DataSource    = dtbl;
         cmbVoucherType.ValueMember   = "voucherTypeId";
         cmbVoucherType.DisplayMember = "voucherTypeName";
         cmbVoucherType.SelectedIndex = 0;
     }
     catch (Exception ex)
     {
         MessageBox.Show("PSRT5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
示例#10
0
        public string SaveDailySalaryVoucher(string dailyMasterId, string voucherTypeId, string voucherNo, string date,
                                             string salaryDate, string cash, string narration, string totalAmount, string details)
        {
            string message = string.Empty;

            try
            {
                decimal       decDailyVoucherTypeId = 0;
                VoucherTypeSP spVoucherType         = new VoucherTypeSP();
                DataTable     dtblVouchetType       = new DataTable();
                dtblVouchetType = spVoucherType.VoucherTypeSelectionComboFill("Daily Salary Voucher");
                int    nCount      = dtblVouchetType.Rows.Count;
                string voucherType = string.Empty;
                if (nCount == 1)
                {
                    voucherType           = dtblVouchetType.Rows[0].ItemArray[0].ToString();
                    decDailyVoucherTypeId = decimal.Parse(voucherType);
                }

                string strEployeeNames = string.Empty;
                DailySalaryVoucherMasterInfo  infoMaster  = new DailySalaryVoucherMasterInfo();
                DailySalaryVoucherMasterSP    spMaster    = new DailySalaryVoucherMasterSP();
                DailySalaryVoucherDetailsInfo infoDetails = new DailySalaryVoucherDetailsInfo();
                DailySalaryVoucherDetailsSP   spDetails   = new DailySalaryVoucherDetailsSP();

                //-------------In multi user case check whether salary is paying for the same persone--------------//
                List <Dictionary <string, object> > detailsData = JsonConvert.DeserializeObject <List <Dictionary <string, object> > >(details);
                int      inCounts     = detailsData.Count;
                int      incont       = 0;
                decimal  decVal       = 0;
                DateTime dtSalaryDate = Convert.ToDateTime(salaryDate);
                for (int i = 0; i < inCounts; i++)
                {
                    decVal = Convert.ToDecimal(detailsData[i]["employeeId"].ToString());
                    if (spDetails.CheckWhetherDailySalaryAlreadyPaid(decVal, dtSalaryDate) != "0")
                    {
                        strEployeeNames = strEployeeNames + spDetails.CheckWhetherDailySalaryAlreadyPaid(decVal, dtSalaryDate) + ",";
                        foreach (char ch in strEployeeNames)
                        {
                            if (ch == ',')
                            {
                                incont++;
                            }
                        }
                        if (incont == 15)
                        {
                            incont          = 0;
                            strEployeeNames = strEployeeNames + Environment.NewLine;
                        }
                    }
                }
                if (spDetails.CheckWhetherDailySalaryAlreadyPaid(decVal, dtSalaryDate) != "0")
                {
                    message = "Salary already paid for - " + " " + strEployeeNames;
                }
                else
                {
                    DateTime dtDate = Convert.ToDateTime(date);
                    if (isAutomatic)
                    {
                        infoMaster.VoucherNo = strVoucherNo;
                    }
                    else
                    {
                        infoMaster.VoucherNo = voucherNo;
                    }
                    infoMaster.Date        = dtDate;
                    infoMaster.SalaryDate  = dtSalaryDate;
                    infoMaster.LedgerId    = Convert.ToDecimal(cash);
                    infoMaster.Narration   = narration ?? string.Empty;
                    infoMaster.TotalAmount = Convert.ToDecimal(totalAmount);
                    infoMaster.Extra1      = string.Empty; // Fields not in design//
                    infoMaster.Extra2      = string.Empty; // Fields not in design//
                    if (isAutomatic)
                    {
                        infoMaster.InvoiceNo = strInvoiceNo;
                    }
                    else
                    {
                        infoMaster.InvoiceNo = voucherNo;
                    }
                    infoMaster.SuffixPrefixId  = 0;//decDailySuffixPrefixId;
                    infoMaster.VoucherTypeId   = decDailyVoucherTypeId;
                    infoMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;

                    int inval   = 0;
                    int inCount = detailsData.Count;
                    for (int i = 0; i < inCount; i++)
                    {
                        if (detailsData[i]["status"].ToString() == "paid")
                        {
                            inval++;
                        }
                    }
                    if (inval >= 0)
                    {
                        decimal decMasterId         = 0;
                        string  strUpdatedVoucherNo = string.Empty;
                        string  strUpdatedInvoiceNo = string.Empty;
                        //-------------checks Voucher No. repeating in Multi user case----------//
                        DataTable dtbl = new DataTable();
                        dtbl = spMaster.DailySalaryVoucherMasterAddWithIdentity(infoMaster, true);
                        foreach (DataRow dr in dtbl.Rows)
                        {
                            decMasterId         = Convert.ToDecimal(dr.ItemArray[0].ToString());
                            strUpdatedVoucherNo = dr.ItemArray[1].ToString();
                            strUpdatedInvoiceNo = dr.ItemArray[2].ToString();
                        }
                        if (!isAutomatic)
                        {
                            strVoucherNo = voucherNo;
                        }
                        if (isAutomatic)
                        {
                            if (Convert.ToDecimal(strUpdatedVoucherNo) != Convert.ToDecimal(strVoucherNo))
                            {
                                message      = "Voucher number changed from  " + strInvoiceNo + "  to  " + strUpdatedInvoiceNo;
                                strVoucherNo = strUpdatedVoucherNo.ToString();
                                strInvoiceNo = strUpdatedInvoiceNo;
                            }
                        }
                        //-------------------------------------//
                        LedgerPostingForDailySalary(Convert.ToDecimal(cash), totalAmount, decDailyVoucherTypeId, voucherNo, date);

                        infoDetails.DailySalaryVocherMasterId = decMasterId;
                        infoDetails.Extra1 = string.Empty; // Fields not in design//
                        infoDetails.Extra2 = string.Empty; // Fields not in design//
                        int inRowCount = detailsData.Count;
                        for (int i = 0; i < inRowCount; i++)
                        {
                            if (detailsData[i]["employeeId"].GetType().Name != "JObject" && detailsData[i]["employeeId"].ToString() != string.Empty)
                            {
                                infoDetails.EmployeeId = Convert.ToDecimal(detailsData[i]["employeeId"].ToString());
                            }
                            if (detailsData[i]["dailyWage"].GetType().Name != "JObject" && detailsData[i]["dailyWage"].ToString() != string.Empty)
                            {
                                infoDetails.Wage = Convert.ToDecimal(detailsData[i]["dailyWage"].ToString());
                            }
                            if (detailsData[i]["status"].GetType().Name != "JObject" && detailsData[i]["status"].ToString() == "paid")
                            {
                                infoDetails.Status = detailsData[i]["status"].ToString();
                            }

                            if (detailsData[i]["status"].ToString() == "paid" && detailsData[i]["masterId"].ToString() == string.Empty)
                            {
                                infoDetails.DailySalaryVocherMasterId = decMasterId;
                                spDetails.DailySalaryVoucherDetailsAdd(infoDetails);
                            }
                        }
                    }
                    else
                    {
                        strVoucherNo = spMaster.DailySalaryVoucherMasterGetMax(Convert.ToDecimal(decDailyVoucherTypeId));
                        message      = "Can't save without at least one employee";
                    }
                }
            }
            catch (Exception ex)
            {
                message = "DSV11:" + ex.Message;
            }
            return(message);
        }