Example #1
0
        public static Acc_Voucher GetAllAcc_WorkFlowVoucher(string voucherKey)
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
            Acc_Voucher       voucher    = new Acc_Voucher();
            IDataReader       reader     = null;
            String            sql        = "select * from Acc_Voucher where VoucherKey='" + voucherKey + "'";

            try
            {
                conManager.OpenDataReader(sql, out reader);
                while (reader.Read())
                {
                    Acc_Voucher newAcc_Voucher = new Acc_Voucher();
                    newAcc_Voucher.SetData(reader);
                    voucher = newAcc_Voucher;
                }
                return(voucher);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
Example #2
0
        public static Acc_Voucher GetAllAcc_Voucher(string voucherNo)
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
            Acc_Voucher       voucher    = new Acc_Voucher();
            IDataReader       reader     = null;
            String            sql        = "select VoucherKey,VoucherTypeKey,FYKey,OrgKey,VoucherDate,VoucherNo,VoucherClient,PayRec,VoucherDesc,IsPost,PostDate,PostBy,EntryDate,EntryUserKey,LastUpdateDate,LastUpdateUserKey,NField_1,NField_2,TField_1,TField_2,TField_3,TField_4,TField_5,DField_1,DField_2,IField_1,BField_1,CheckNo,CheckDate from Acc_Voucher where VoucherNo='" + voucherNo + "'";

            try
            {
                conManager.OpenDataReader(sql, out reader);
                while (reader.Read())
                {
                    Acc_Voucher newAcc_Voucher = new Acc_Voucher();
                    newAcc_Voucher.SetData(reader);
                    voucher = newAcc_Voucher;
                }
                return(voucher);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
Example #3
0
        public static CustomList <Acc_Voucher> GetAllAcc_Voucher(Int32 CostCenterID, Int32 BranchOrUnit, Int32 bankBranch, String fromDate, String toDate)
        {
            ConnectionManager        conManager            = new ConnectionManager(ConnectionName.HR);
            CustomList <Acc_Voucher> Acc_VoucherCollection = new CustomList <Acc_Voucher>();
            IDataReader reader = null;
            String      sql    = "spBankReconciliation " + CostCenterID + "," + BranchOrUnit + "," + bankBranch + "," + "'" + fromDate + "','" + toDate + "'";

            try
            {
                conManager.OpenDataReader(sql, out reader);
                while (reader.Read())
                {
                    Acc_Voucher newAcc_Voucher = new Acc_Voucher();
                    newAcc_Voucher.SetDataBankReconciliation(reader);
                    Acc_VoucherCollection.Add(newAcc_Voucher);
                }
                return(Acc_VoucherCollection);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
Example #4
0
        public static CustomList <Acc_Voucher> GetAllAcc_Voucher(Int32 VoucherTypeKey)
        {
            ConnectionManager        conManager            = new ConnectionManager(ConnectionName.HR);
            CustomList <Acc_Voucher> Acc_VoucherCollection = new CustomList <Acc_Voucher>();
            IDataReader reader = null;
            String      sql    = "spFindVoucher " + VoucherTypeKey;

            try
            {
                conManager.OpenDataReader(sql, out reader);
                while (reader.Read())
                {
                    Acc_Voucher newAcc_Voucher = new Acc_Voucher();
                    newAcc_Voucher.SetData(reader);
                    Acc_VoucherCollection.Add(newAcc_Voucher);
                }
                return(Acc_VoucherCollection);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
Example #5
0
        public static CustomList <Acc_Voucher> GetAllAcc_VoucherSearch(string searchStr, string blank)
        {
            ConnectionManager        conManager            = new ConnectionManager(ConnectionName.HR);
            CustomList <Acc_Voucher> Acc_VoucherCollection = new CustomList <Acc_Voucher>();
            IDataReader reader = null;
            String      sql    = "EXEC spGetSearchVoucher " + searchStr;

            try
            {
                conManager.OpenDataReader(sql, out reader);
                while (reader.Read())
                {
                    Acc_Voucher newAcc_Voucher = new Acc_Voucher();
                    newAcc_Voucher.SetDataSearch(reader);
                    Acc_VoucherCollection.Add(newAcc_Voucher);
                }
                return(Acc_VoucherCollection);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
Example #6
0
        public static CustomList <Acc_Voucher> GetAllAcc_Voucher()
        {
            ConnectionManager        conManager            = new ConnectionManager(ConnectionName.HR);
            CustomList <Acc_Voucher> Acc_VoucherCollection = new CustomList <Acc_Voucher>();
            IDataReader  reader = null;
            const String sql    = "select VoucherKey,VoucherTypeKey,FYKey,OrgKey,VoucherDate,VoucherNo,VoucherClient,PayRec,VoucherDesc,IsPost,PostDate,PostBy,EntryDate,EntryUserKey,LastUpdateDate,LastUpdateUserKey,NField_1,NField_2,TField_1,TField_2,TField_3,TField_4,TField_5,DField_1,DField_2,IField_1,BField_1,CheckNo,CheckDate from Acc_Voucher Where IsPost=0 Order By VoucherDate Desc";

            try
            {
                conManager.OpenDataReader(sql, out reader);
                while (reader.Read())
                {
                    Acc_Voucher newAcc_Voucher = new Acc_Voucher();
                    newAcc_Voucher.SetData(reader);
                    Acc_VoucherCollection.Add(newAcc_Voucher);
                }
                Acc_VoucherCollection.InsertSpName = "spInsertAcc_Voucher";
                Acc_VoucherCollection.UpdateSpName = "spUpdateAcc_Voucher";
                Acc_VoucherCollection.DeleteSpName = "spDeleteAcc_Voucher";
                return(Acc_VoucherCollection);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
Example #7
0
        private void SetDataInControls(Acc_Voucher aV)
        {
            try
            {
                txtVoucher.Text = aV.VoucherNo;
                txtVoucherDate_nc.Text = aV.VoucherDate == DateTime.MinValue ? string.Empty : aV.VoucherDate.ToString(STATIC.StaticInfo.GridDateFormat);
                if (aV.CurrencyID != 0)
                    ddlCurrencyID.SelectedValue = aV.CurrencyID.ToString();
                txtChequeNo.Text = aV.CheckNo;
                txtChequeDate.Text = aV.CheckDate == DateTime.MinValue ? string.Empty : aV.CheckDate.ToString(StaticInfo.GridDateFormat);

                txtVoucherDescription.Text = aV.VoucherDesc;
                txtChequeNo.Text = aV.CheckNo;
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Example #8
0
 private void PopulatePFVoucherInformation(Acc_Voucher aV)
 {
     try
     {
         SetDataInControls(aV);
         AccVoucherDetList = manager.GetAllAcc_VoucherDet(aV.VoucherKey);
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
Example #9
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         Decimal totalDr = 0.0M;
         Decimal totalCr = 0.0M;
         CustomList<Acc_Voucher> lstAccVoucher = AccVoucherList;
         if (lstAccVoucher.Count == 0)
         {
             Acc_Voucher newVoucher = new Acc_Voucher();
             lstAccVoucher.Add(newVoucher);
         }
         SetDataFromControlToObject(ref lstAccVoucher);
         CustomList<Acc_VoucherDet> lstAccVoucherDet = AccVoucherDetList;
         foreach (Acc_VoucherDet vD in lstAccVoucherDet)
         {
             totalDr += vD.Dr;
             totalCr += vD.Cr;
         }
         if (totalDr == totalCr)
         {
             if (!((PageBase)this.Page).CheckUserAuthentication(lstAccVoucher, lstAccVoucherDet)) return;
             manager.SavePFVoucher(ref lstAccVoucher, ref lstAccVoucherDet, prifix);
             if (StatusID > 0)
                 _WF.InsertWorkFlowTransaction(MenuID,StatusID, UserCode, 0, lstAccVoucher[0].VoucherKey, true, "", false, false);
             ((PageBase)this.Page).SuccessMessage = (StaticInfo.SavedSuccessfullyMsg + ". Voucher No: " + manager.VoucherID);
         }
         else
         {
             ((PageBase)this.Page).ErrorMessage = ("Dr and Cr must be equal.");
             return;
         }
         btnNew_Click(null, null);
     }
     catch (SqlException ex)
     {
         ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex));
     }
     catch (Exception ex)
     {
         ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getExceptionMessage(ex));
     }
 }
Example #10
0
 public static Acc_Voucher GetAllAcc_WorkFlowVoucher(string voucherKey)
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     Acc_Voucher voucher = new Acc_Voucher();
     IDataReader reader = null;
     String sql = "select * from Acc_Voucher where VoucherKey='" + voucherKey + "'";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             Acc_Voucher newAcc_Voucher = new Acc_Voucher();
             newAcc_Voucher.SetData(reader);
             voucher = newAcc_Voucher;
         }
         return voucher;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
Example #11
0
 public static Acc_Voucher GetAllAcc_Voucher(string voucherNo)
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     Acc_Voucher voucher = new Acc_Voucher();
     IDataReader reader = null;
     String sql = "select VoucherKey,VoucherTypeKey,FYKey,OrgKey,VoucherDate,VoucherNo,VoucherClient,PayRec,VoucherDesc,IsPost,PostDate,PostBy,EntryDate,EntryUserKey,LastUpdateDate,LastUpdateUserKey,NField_1,NField_2,TField_1,TField_2,TField_3,TField_4,TField_5,DField_1,DField_2,IField_1,BField_1,CheckNo,CheckDate from Acc_Voucher where VoucherNo='" + voucherNo + "'";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             Acc_Voucher newAcc_Voucher = new Acc_Voucher();
             newAcc_Voucher.SetData(reader);
             voucher = newAcc_Voucher;
         }
         return voucher;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
Example #12
0
 public static CustomList<Acc_Voucher> GetAllAcc_Voucher(Int32 CostCenterID, Int32 BranchOrUnit, Int32 bankBranch, String fromDate, String toDate)
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<Acc_Voucher> Acc_VoucherCollection = new CustomList<Acc_Voucher>();
     IDataReader reader = null;
     String sql = "spBankReconciliation " + CostCenterID + "," + BranchOrUnit + "," + bankBranch + "," + "'" + fromDate + "','" + toDate + "'";
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             Acc_Voucher newAcc_Voucher = new Acc_Voucher();
             newAcc_Voucher.SetDataBankReconciliation(reader);
             Acc_VoucherCollection.Add(newAcc_Voucher);
         }
         return Acc_VoucherCollection;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }
Example #13
0
 public static CustomList<Acc_Voucher> GetAllAcc_Voucher(Int32 VoucherTypeKey)
 {
     ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
     CustomList<Acc_Voucher> Acc_VoucherCollection = new CustomList<Acc_Voucher>();
     IDataReader reader = null;
     String sql = "spFindVoucher "+VoucherTypeKey;
     try
     {
         conManager.OpenDataReader(sql, out reader);
         while (reader.Read())
         {
             Acc_Voucher newAcc_Voucher = new Acc_Voucher();
             newAcc_Voucher.SetData(reader);
             Acc_VoucherCollection.Add(newAcc_Voucher);
         }
         return Acc_VoucherCollection;
     }
     catch(Exception ex)
     {
         throw (ex);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
 }