/// <summary> /// LogicDeleteInfo /// </summary> /// <param name="id"></param> /// <param name="loginUser"></param> /// <returns></returns> public bool LogicDeleteInfo(long id, string loginUser) { BusinessExpenseInInfo info = dal.GetInfo(id); if (info.ApprovalFlag.GetValueOrDefault()) { throw new Exception("MC:0x00000347");///已审核的费用不允许删除 } if (info.CheckFlag.GetValueOrDefault()) { throw new Exception("MC:0x00000345");///已开票的费用不允许删除 } if (info.PaymentFlag.GetValueOrDefault()) { throw new Exception("MC:0x00000346");///已销账的费用不允许删除 } return(dal.LogicDelete(id, loginUser) > 0 ? true : false); }
/// <summary> /// InsertInfo /// </summary> /// <param name="info"></param> /// <returns></returns> public long InsertInfo(BusinessExpenseInInfo info) { if (info.SourceBusinessFid == null) { info.SourceBusinessFid = new PlanPullOrderDAL().GetFid(info.OrderNo); info.SourceBusinessNo = info.OrderNo; } ///获取费用类型 if (!string.IsNullOrEmpty(info.ExpenseCode)) { info.ExpenseType = new ExpenseItemDAL().GetExpenseType(info.ExpenseCode); } ///流程标记默认为false,否则检索条件不能成功检索 info.ApprovalFlag = false; ///审核 info.CheckFlag = false; ///开票 info.PaymentFlag = false; ///销账 return(dal.Add(info)); }
/// <summary> /// InsertInfo /// </summary> /// <param name="info"></param> /// <returns></returns> public long InsertInfo(BusinessExpenseInInfo info) { return(new BusinessExpenseInBLL().InsertInfo(info)); }
/// <summary> /// UpdateInfo /// </summary> /// <param name="fields"></param> /// <param name="id"></param> /// <returns></returns> public bool UpdateInfo(string fields, long id) { BusinessExpenseInInfo info = dal.GetInfo(id); if (info == null) { throw new Exception("MC:0x00000084");///数据错误 } if (info.PaymentFlag.GetValueOrDefault()) { throw new Exception("MC:0x00000459");///已销账不允许进行修改 } ///开票->销账之间 if (info.CheckFlag.GetValueOrDefault()) { ///实收金额 string actualAmount = CommonBLL.GetFieldValue(fields, "ACTUAL_AMOUNT"); if (string.IsNullOrEmpty(actualAmount)) { actualAmount = "NULL"; } ///财务凭证号 string fiDocNo = CommonBLL.GetFieldValue(fields, "FI_DOC_NO"); if (string.IsNullOrEmpty(fiDocNo)) { fiDocNo = string.Empty; } /// string loginUser = CommonBLL.GetFieldValue(fields, "MODIFY_USER"); return(dal.UpdateInfo("" + "[ACTUAL_AMOUNT] = " + actualAmount + "," + "[FI_DOC_NO] = N'" + fiDocNo + "'," + "[MODIFY_DATE] = GETDATE()," + "[MODIFY_USER] = N'" + loginUser + "'", id) > 0 ? true : false); } ///审核->开票之间 if (info.ApprovalFlag.GetValueOrDefault()) { ///实收金额 string actualAmount = CommonBLL.GetFieldValue(fields, "ACTUAL_AMOUNT"); if (string.IsNullOrEmpty(actualAmount)) { actualAmount = "NULL"; } ///财务凭证号 string fiDocNo = CommonBLL.GetFieldValue(fields, "FI_DOC_NO"); if (string.IsNullOrEmpty(fiDocNo)) { fiDocNo = string.Empty; } ///发票号 string invoiceNo = CommonBLL.GetFieldValue(fields, "INVOICE_NO"); if (string.IsNullOrEmpty(invoiceNo)) { invoiceNo = string.Empty; } ///开票抬头 string invoiceTitle = CommonBLL.GetFieldValue(fields, "INVOICE_TITLE"); if (string.IsNullOrEmpty(invoiceTitle)) { invoiceTitle = string.Empty; } /// string loginUser = CommonBLL.GetFieldValue(fields, "MODIFY_USER"); return(dal.UpdateInfo("" + "[ACTUAL_AMOUNT] = " + actualAmount + "," + "[FI_DOC_NO] = N'" + fiDocNo + "'," + "[INVOICE_NO] = N'" + invoiceNo + "'," + "[INVOICE_TITLE] = N'" + invoiceTitle + "'," + "[MODIFY_DATE] = GETDATE()," + "[MODIFY_USER] = N'" + loginUser + "'", id) > 0 ? true : false); } return(dal.UpdateInfo(fields, id) > 0 ? true : false); }