Exemplo n.º 1
0
        public string SaveVoucher(VOUCHEREntity SaveData)
        {
            var v = GetVerify(SaveData);

            if (SaveData.VOUCHERID.IsEmpty())
            {
                SaveData.VOUCHERID = NewINC("VOUCHER");
            }
            SaveData.STATUS        = ((int)普通单据状态.未审核).ToString();
            SaveData.REPORTER      = employee.Id;
            SaveData.REPORTER_NAME = employee.Name;
            SaveData.REPORTER_TIME = DateTime.Now.ToString();
            SaveData.VERIFY        = employee.Id;
            v.Require(a => a.VOUCHERID);
            v.Require(a => a.VOUCHERNAME);
            v.Verify();

            using (var Tran = DbHelper.BeginTransaction())
            {
                SaveData.VOUCHER_MAKESQL?.ForEach(item =>
                {
                    GetVerify(item).Require(a => a.SQLINX);
                });
                DbHelper.Save(SaveData);

                Tran.Commit();
            }
            return(SaveData.VOUCHERID);
        }
Exemplo n.º 2
0
 public void DeleteVoucher(List <VOUCHEREntity> DeleteData)
 {
     foreach (var item in DeleteData)
     {
         VOUCHEREntity Data = DbHelper.Select(item);
         if (Data.STATUS == ((int)普通单据状态.审核).ToString())
         {
             throw new LogicException("已经审核不能删除!");
         }
     }
     using (var Tran = DbHelper.BeginTransaction())
     {
         foreach (var item in DeleteData)
         {
             DbHelper.Delete(item);
         }
         Tran.Commit();
     }
 }
Exemplo n.º 3
0
        public Tuple <dynamic, DataTable, DataTable, DataTable, DataTable> GetVoucherElement(VOUCHEREntity Data)
        {
            string sql = $@"SELECT A.* "
                         + "FROM VOUCHER A "
                         + "WHERE 1=1 ";

            if (!Data.VOUCHERID.IsEmpty())
            {
                sql += (" AND A.VOUCHERID= " + Data.VOUCHERID);
            }
            DataTable voucher = DbHelper.ExecuteTable(sql);

            voucher.NewEnumColumns <账单类型>("VOUCHERTYPE", "VOUCHERTYPEMC");
            voucher.NewEnumColumns <普通单据状态>("STATUS", "STATUSMC");

            string sqlvouchersql = $@"SELECT M.*" +
                                   " FROM VOUCHER_MAKESQL M" +
                                   " where  1=1";

            if (!Data.VOUCHERID.IsEmpty())
            {
                sqlvouchersql += (" and M.VOUCHERID= " + Data.VOUCHERID);
            }
            DataTable vouchersql = DbHelper.ExecuteTable(sqlvouchersql);

            string sqlvoucherrecord = $@"SELECT M.*" +
                                      " FROM VOUCHER_RECORD M" +
                                      " where  1=1";

            if (!Data.VOUCHERID.IsEmpty())
            {
                sqlvoucherrecord += (" and M.VOUCHERID= " + Data.VOUCHERID);
            }
            DataTable voucherrecord = DbHelper.ExecuteTable(sqlvoucherrecord);

            string sqlvoucherrecordpzkm = $@"SELECT M.*" +
                                          " FROM VOUCHER_RECORD_PZKM M" +
                                          " where  1=1";

            if (!Data.VOUCHERID.IsEmpty())
            {
                sqlvoucherrecordpzkm += (" and M.VOUCHERID= " + Data.VOUCHERID);
            }
            DataTable voucherrecordpzkm = DbHelper.ExecuteTable(sqlvoucherrecordpzkm);

            string sqlvoucherrecordzy = $@"SELECT M.*" +
                                        " FROM VOUCHER_RECORD_ZY M" +
                                        " where  1=1";

            if (!Data.VOUCHERID.IsEmpty())
            {
                sqlvoucherrecordzy += (" and M.VOUCHERID= " + Data.VOUCHERID);
            }
            DataTable voucherrecordzy = DbHelper.ExecuteTable(sqlvoucherrecordzy);

            return(new Tuple <dynamic, DataTable, DataTable, DataTable, DataTable>(voucher.ToOneLine(), vouchersql, voucherrecord, voucherrecordpzkm, voucherrecordzy));
        }