| | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | DataSet ds; |
| | | |
| | | public class ClsYS_ReceiveOtherBillSubs |
| | | { |
| | | |
| | | public Int64 HProjectMoneyIDSub;// int //费用项目 |
| | | public string HTypeSub;// varchar(20) --发票类型 |
| | | public double HMoneySub;// dec(18,8) //单据金额 |
| | | public double HTaxRateSub;// dec(18,8) //税率 |
| | | public double HSumMoneySub;// dec(18,8) //总金额 |
| | | } |
| | | |
| | | |
| | | #region 其他应收单列表 查询 |
| | | /// <summary> |
| | | /// 返回项目阶段列表 |
| | |
| | | var _value = msg["msg"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); //表头数据 |
| | | string refSav = sArray[1].ToString(); //操作方式 |
| | | string msg4 = sArray[2].ToString(); //用户 |
| | | string msg2 = sArray[0].ToString(); |
| | | string msg3 = sArray[1].ToString(); //子表 |
| | | string refSav = sArray[2].ToString();//操作方式数据类型 1添加 3修改 2 复制 |
| | | string msg4 = sArray[3].ToString();//用户名 |
| | | |
| | | DBUtility.ClsPub.CurUserName = msg4; |
| | | |
| | |
| | | } |
| | | oBill.omodel = oItem; |
| | | } |
| | | // 表体数据 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | msg3 = msg3.Replace("\\", ""); |
| | | msg3 = msg3.Replace("\n", ""); //\n |
| | | List<Model.ClsYS_ReceiveOtherBillSub> ls = new List<Model.ClsYS_ReceiveOtherBillSub>(); |
| | | ls = oListModels.getObjectByJson_YS_ReceiveOtherBillSub(msg3); |
| | | int i = 0; |
| | | foreach (Model.ClsYS_ReceiveOtherBillSub oItemSub in ls) |
| | | { |
| | | i++; |
| | | oItemSub.HEntryID = i; |
| | | |
| | | |
| | | oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | oItemSub.HCloseType = false; //关闭类型 |
| | | |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | |
| | | //进行 会计期间 结账 的判断和控制 |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = DateTime.Now; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //保存 |
| | | //保存完毕后处理 |
| | |
| | | { |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_YS_ReceiveOtherBillMainList where hmainid=" + HInterID, "h_v_YS_ReceiveOtherBillMainList"); |
| | | List<DataTable> tableList = new List<DataTable>(); |
| | | |
| | | ds = oCN.RunProcReturn("exec h_p_YS_ReceiveOtherBillMain_Edit " + HInterID, "h_p_YS_ReceiveOtherBillMain_Edit"); |
| | | tableList.Add(ds.Tables[0]); |
| | | tableList.Add(ds.Tables[1]); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.data = tableList; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //判断是否可编辑 |
| | | //判断是否可删除 |
| | | if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_YS_ReceiveOtherBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_YS_ReceiveOtherBill_BeforeDelCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | //判断是否是创建状态进行删除 |
| | | if (int.Parse(BillOld.omodel.HBillStatus.ToString()) <= 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | //进行 会计期间 结账 的判断和控制 |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = DateTime.Now; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_YS_ReceiveOtherBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_YS_ReceiveOtherBill_BeforeDelCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | oCN.RunProc("delete from YS_ReceiveOtherBillMain where HInterID = " + HInterID); |
| | | oCN.RunProc("delete from YS_ReceiveOtherBillSub where HInterID= " + HInterID); |
| | | |
| | | //删除后控制================================================================================== |
| | | string sql2 = "exec h_p_YS_ReceiveOtherBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql2, "h_p_YS_ReceiveOtherBill_AfterDelCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | s = "删除后判断失败,请与网络管理人员联系"; |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + s; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | s = ds.Tables[0].Rows[0]["HRemark"].ToString(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + s; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | //============================================================================================== |
| | | |
| | | oCN.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.Message = "删除成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据不是创建状态,不允许删除!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | oCN.RunProc("delete from YS_ReceiveOtherBillMain where HInterID = " + HInterID); |
| | | oCN.RunProc("delete from YS_ReceiveOtherBillSub where HInterID= " + HInterID); |
| | | |
| | | //删除后控制================================================================================== |
| | | string sql2 = "exec h_p_YS_ReceiveOtherBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql2, "h_p_YS_ReceiveOtherBill_AfterDelCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | s = "删除后判断失败,请与网络管理人员联系"; |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + s; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | s = ds.Tables[0].Rows[0]["HRemark"].ToString(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + s; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | //============================================================================================== |
| | | |
| | | oCN.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | //进行需要进行的审核/反审核操作 |
| | | if (IsAudit == 0) //审核提交 |
| | | { |
| | | //进行 会计期间 结账 的判断和控制 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = DateTime.Now; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | //记录返回信息 |
| | | string msg = ""; |
| | | |
| | | if(oBill.omodel.HMainSourceInterID != 0) |
| | | string sql = "exec h_p_YS_ReceiveOtherBill_CheckCrediControl " + oBill.omodel.HInterID; |
| | | ds = oCN.RunProcReturn(sql, "h_p_YS_ReceiveOtherBill_CheckCrediControl"); |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() == "1") |
| | | { |
| | | //检验源单是否存在及单据状态 |
| | | string sql = "select * from YS_ReceiveOtherBillMain where HInterID = " + oBill.omodel.HMainSourceInterID; |
| | | ds = oCN.RunProcReturn(sql, "YS_ReceiveOtherBillMain"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "审核失败!原因:源单-特批申请单不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else if (ds.Tables[0].Rows[0]["HBillStatus"].ToString() != "2") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "审核失败!原因:源单-特批申请单未处于已审核状态!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //审核前控制========================================= |
| | |
| | | } |
| | | if (IsAudit == 1) //反审核提交 |
| | | { |
| | | |
| | | //进行 会计期间 结账 的判断和控制 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = DateTime.Now; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //反审核前控制========================================= |
| | | string sql1 = "exec h_p_YS_ReceiveOtherBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_YS_ReceiveOtherBill_BeforeUnCheckCtrl"); |