2024-03-11 合同发票修改
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Model;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Model;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Model;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web.UI.WebControls;
|
||||
using Model;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Model;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
@@ -21,12 +24,18 @@ namespace BLL
|
||||
return Funs.DB.PHTGL_Approve.FirstOrDefault(e => e.ApproveId == ApproveId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取未审批记录
|
||||
/// </summary>
|
||||
/// <param name="contractId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.PHTGL_Approve> GetPHTGL_ApproveByContractId(string contractId)
|
||||
{
|
||||
var q = (from x in Funs.DB.PHTGL_Approve where x.ContractId == contractId && x.State == 0 select x).ToList();
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///获取当前人员的所有审批信息
|
||||
/// </summary>
|
||||
@@ -80,6 +89,22 @@ namespace BLL
|
||||
return IsExit;
|
||||
}
|
||||
/// <summary>
|
||||
/// 判断当前人员是否正在审批
|
||||
/// </summary>
|
||||
/// <param name="contractId"></param>
|
||||
/// <param name="approveMan"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsApprovingMan(string contractId, string approveMan)
|
||||
{
|
||||
bool IsExit = false;
|
||||
var q = (from x in Funs.DB.PHTGL_Approve where x.ContractId == contractId && x.ApproveMan == approveMan && x.State==0 select x).ToList();
|
||||
if (q.Count>0)
|
||||
{
|
||||
IsExit = true;
|
||||
}
|
||||
return IsExit;
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加审批人员记录
|
||||
/// </summary>
|
||||
/// <param name="newtable"></param>
|
||||
@@ -207,23 +232,70 @@ namespace BLL
|
||||
/// </summary>
|
||||
/// <param name="ContractId"></param>
|
||||
/// <returns></returns>
|
||||
public static DataTable GetAllApproveData(string ContractId)
|
||||
//public static DataTable GetAllApproveData(string ContractId)
|
||||
//{
|
||||
// string strSql = @" select u.PersonName as ApproveMan,
|
||||
// App.ApproveDate,
|
||||
// (CASE App.IsAgree WHEN '1' THEN '不同意'
|
||||
// WHEN '2' THEN '同意' END) AS IsAgree,
|
||||
// App.ApproveIdea,
|
||||
// App.ApproveId,
|
||||
// App.ApproveType
|
||||
// from PHTGL_Approve as App"
|
||||
// + @" left join Person_Persons AS U ON U.PersonId = App.ApproveMan WHERE 1=1 and App.IsAgree <>0 and app.ContractId= @ContractId order by convert(datetime ,App.ApproveDate) ";
|
||||
// List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
// listStr.Add(new SqlParameter("@ContractId", ContractId));
|
||||
// SqlParameter[] parameter = listStr.ToArray();
|
||||
// DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
// return tb;
|
||||
//}
|
||||
public static IEnumerable GetAllApproveData(string contractId)
|
||||
{
|
||||
string strSql = @" select u.PersonName as ApproveMan,
|
||||
App.ApproveDate,
|
||||
(CASE App.IsAgree WHEN '1' THEN '不同意'
|
||||
WHEN '2' THEN '同意' END) AS IsAgree,
|
||||
App.ApproveIdea,
|
||||
App.ApproveId,
|
||||
App.ApproveType
|
||||
from PHTGL_Approve as App"
|
||||
+ @" left join Person_Persons AS U ON U.PersonId = App.ApproveMan WHERE 1=1 and App.IsAgree <>0 and app.ContractId= @ContractId order by convert(datetime ,App.ApproveDate) ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@ContractId", ContractId));
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
return tb;
|
||||
var result = (from x in Funs.DB.PHTGL_Approve
|
||||
join u in Funs.DB.Person_Persons on x.ApproveMan equals u.PersonId
|
||||
where x.IsAgree != 0 && x.ContractId == contractId
|
||||
orderby x.ApproveDate
|
||||
select new
|
||||
{
|
||||
ApproveMan = u.PersonName,
|
||||
x.ApproveDate,
|
||||
IsAgree = x.IsAgree == 1 ? "不同意" : "同意",
|
||||
x.ApproveIdea,
|
||||
x.ApproveId,
|
||||
x.ApproveType,
|
||||
x.ApproveForm
|
||||
}
|
||||
|
||||
).ToList();
|
||||
|
||||
return result;
|
||||
}
|
||||
public static IEnumerable GetAllApproveData(string contractId,string aproveForm)
|
||||
{
|
||||
var result = (from x in Funs.DB.PHTGL_Approve
|
||||
join u in Funs.DB.Person_Persons on x.ApproveMan equals u.PersonId
|
||||
where x.IsAgree != 0 && x.ContractId == contractId
|
||||
orderby x.ApproveDate
|
||||
select new
|
||||
{
|
||||
ApproveMan = u.PersonName,
|
||||
x.ApproveDate,
|
||||
IsAgree = x.IsAgree == 1 ? "不同意" : "同意",
|
||||
x.ApproveIdea,
|
||||
x.ApproveId,
|
||||
x.ApproveType,
|
||||
x.ApproveForm
|
||||
}
|
||||
|
||||
).ToList();
|
||||
if (!string.IsNullOrEmpty(aproveForm))
|
||||
{
|
||||
result = result.Where(x => x.ApproveForm == aproveForm).ToList();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取最后拒绝的人员
|
||||
/// </summary>
|
||||
@@ -243,57 +315,4 @@ namespace BLL
|
||||
return tb;
|
||||
}
|
||||
}
|
||||
public class ApproveManModel
|
||||
{
|
||||
public int Number
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string userid
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string Rolename
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
}
|
||||
public class PrintModel
|
||||
{
|
||||
public int Number
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string Rolename
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string UserName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string Image
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string ApproveIdea
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string ApproveDate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,8 +217,6 @@ namespace BLL
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void UpdatePHTGL_ContractTrack(PHTGL_ContractTrack newtable)
|
||||
{
|
||||
var table = Funs.DB.PHTGL_ContractTrack.FirstOrDefault(x => x.Id == newtable.Id);
|
||||
@@ -1341,110 +1339,5 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public class PHTGL_ContractTrackDtoIn
|
||||
{
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("A")] public string SerialNumber { get; set; }
|
||||
/// <summary>
|
||||
/// 主项号
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("B")] public string MainItemCode { get; set; }
|
||||
/// <summary>
|
||||
/// 主项名称
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("C")] public string MainItemName { get; set; }
|
||||
/// <summary>
|
||||
/// 专业代码
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("D")] public string MajorCode { get; set; }
|
||||
/// <summary>
|
||||
/// 专业工程名称
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("E")] public string MajorName { get; set; }
|
||||
/// <summary>
|
||||
/// 分部工程
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("F")] public string SubProject { get; set; }
|
||||
/// <summary>
|
||||
/// 分项工程
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("G")] public string SubItemProject { get; set; }
|
||||
/// <summary>
|
||||
/// 项目编码
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("H")] public string ProjectCode { get; set; }
|
||||
/// <summary>
|
||||
/// 项目名称
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("I")] public string ProjectName { get; set; }
|
||||
/// <summary>
|
||||
/// 项目特征描述
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("J")] public string ProjectDescription { get; set; }
|
||||
/// <summary>
|
||||
/// 计量单位
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("K")] public string UnitOfMeasurement { get; set; }
|
||||
/// <summary>
|
||||
/// 工程量
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("L")] public string Quantity { get; set; }
|
||||
/// <summary>
|
||||
/// 全费用固定综合单价
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("M")] public decimal TotalCostFixedComprehensiveUnitPrice { get; set; }
|
||||
/// <summary>
|
||||
/// 其中:主材费
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("N")] public decimal MainMaterialCost { get; set; }
|
||||
/// <summary>
|
||||
/// 合价/元
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("O")] public decimal TotalPrice { get; set; }
|
||||
/// <summary>
|
||||
/// 计算规则
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("P")] public string CalculationRule { get; set; }
|
||||
/// <summary>
|
||||
/// 工作内容
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("Q")] public string WorkContent { get; set; }
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("R")] public string Remarks { get; set; }
|
||||
/// <summary>
|
||||
/// 施工分包商
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("S")] public string ConstructionSubcontractor { get; set; }
|
||||
/// <summary>
|
||||
/// 主材供应方
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("T")] public string MaterialSupplier { get; set; }
|
||||
/// <summary>
|
||||
/// 是否总包合同范围内
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("U")]
|
||||
public string IsWithinGeneralContractScope { get; set; }
|
||||
/// <summary>
|
||||
/// 概算工程量
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("V")] public string EstimatedQuantity { get; set; }
|
||||
/// <summary>
|
||||
/// 概算金额
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("W")] public decimal EstimatedAmount { get; set; }
|
||||
/// <summary>
|
||||
/// 预算工程量
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("X")] public string SettledQuantity { get; set; }
|
||||
/// <summary>
|
||||
/// 预算金额
|
||||
/// </summary>
|
||||
[ExcelColumnIndex("Y")] public decimal SettledAmount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,587 @@
|
||||
using EmitMapper;
|
||||
using FineUIPro;
|
||||
using MiniExcelLibs;
|
||||
using MiniExcelLibs.Attributes;
|
||||
using Model;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using WIA;
|
||||
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
|
||||
public static class PhtglInvoiceService
|
||||
{
|
||||
/// <summary>
|
||||
/// 已导入
|
||||
/// </summary>
|
||||
public static int StateDataIn = -1;
|
||||
/// <summary>
|
||||
/// 已创建入库订单
|
||||
/// </summary>
|
||||
public static int StateCreate = 0;
|
||||
/// <summary>
|
||||
/// 入库审核
|
||||
/// </summary>
|
||||
public static int StateInPutApprove = 1;
|
||||
/// <summary>
|
||||
/// 入库审核拒绝
|
||||
/// </summary>
|
||||
public static int StateInPutApproveRefuse = 2;
|
||||
/// <summary>
|
||||
/// 入库审核成功
|
||||
/// </summary>
|
||||
public static int StateInPutApproveSuccess = 3;
|
||||
/// <summary>
|
||||
/// 出库审核中
|
||||
/// </summary>
|
||||
public static int StateOutPutApprove = 4;
|
||||
/// <summary>
|
||||
/// 出库审核拒绝
|
||||
/// </summary>
|
||||
public static int StateOutPutApproveRefuse = 5;
|
||||
/// <summary>
|
||||
/// 出库审核成功
|
||||
/// </summary>
|
||||
public static int StateOutPutApproveSuccess = 6;
|
||||
|
||||
public static string GetState(object invoiceId)
|
||||
{
|
||||
string result = "";
|
||||
if (invoiceId!=null && !string.IsNullOrEmpty(invoiceId.ToString()) )
|
||||
{
|
||||
var InvoiceId=invoiceId.ToString();
|
||||
|
||||
var model = GetPHTGL_InvoiceById(InvoiceId);
|
||||
var approveModel = PHTGL_ApproveService.GetPHTGL_ApproveByContractId(InvoiceId);
|
||||
|
||||
switch (model.State)
|
||||
{
|
||||
case -1:
|
||||
result = "已导入";
|
||||
break;
|
||||
case 0:
|
||||
result = "已创建入库订单";
|
||||
break;
|
||||
case 1:
|
||||
result = "入库审核中"+",当前节点-"+BLL.Person_PersonsService.getPersonsNamesPersonIds(string.Join(",",approveModel.Select(x => x.ApproveMan)));
|
||||
break;
|
||||
case 2:
|
||||
result = "入库审核拒绝";
|
||||
break;
|
||||
case 3:
|
||||
result = "入库审核成功";
|
||||
break;
|
||||
case 4:
|
||||
result = "出库审核中" + ",当前节点-" + BLL.Person_PersonsService.getPersonsNamesPersonIds(string.Join(",", approveModel.Select(x => x.ApproveMan)));
|
||||
break;
|
||||
case 5:
|
||||
result = "出库审核拒绝";
|
||||
break;
|
||||
case 6:
|
||||
result = "出库审核成功";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#region 获取列表
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
/// </summary>
|
||||
public static int Count
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public static IEnumerable<Model.PHTGL_Invoice> GetPHTGL_InvoiceByModle(Model.PHTGL_Invoice table)
|
||||
{
|
||||
var q = from x in Funs.DB.PHTGL_Invoice
|
||||
where
|
||||
(string.IsNullOrEmpty(table.InvoiceId) || x.InvoiceId.Contains(table.InvoiceId)) &&
|
||||
(string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) &&
|
||||
(string.IsNullOrEmpty(table.ContractId) || x.ProjectId.Contains(table.ContractId)) &&
|
||||
(string.IsNullOrEmpty(table.InvoiceCode) || x.InvoiceCode.Contains(table.InvoiceCode)) &&
|
||||
(string.IsNullOrEmpty(table.InvoiceNumber) || x.InvoiceNumber.Contains(table.InvoiceNumber)) &&
|
||||
(string.IsNullOrEmpty(table.SellerName) || x.SellerName.Contains(table.SellerName)) &&
|
||||
(string.IsNullOrEmpty(table.InvoiceDate) || x.InvoiceDate.Contains(table.InvoiceDate)) &&
|
||||
(string.IsNullOrEmpty(table.Remark) || x.Remark.Contains(table.Remark)) &&
|
||||
(string.IsNullOrEmpty(table.ImagePath) || x.ImagePath.Contains(table.ImagePath)) &&
|
||||
(string.IsNullOrEmpty(table.SellerTaxNumber) || x.SellerTaxNumber.Contains(table.SellerTaxNumber)) &&
|
||||
(string.IsNullOrEmpty(table.ApproveManJson) || x.ApproveManJson.Contains(table.ApproveManJson)) &&
|
||||
(string.IsNullOrEmpty(table.CreateUser) || x.CreateUser.Contains(table.CreateUser)) &&
|
||||
(table.State==null ||x.State==table.State)
|
||||
select x
|
||||
;
|
||||
|
||||
return q.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取分页列表
|
||||
/// </summary>
|
||||
/// <param name="table"></param>
|
||||
/// <param name="grid1"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable GetListData(Model.PHTGL_Invoice table, Grid grid1)
|
||||
{
|
||||
var q = GetPHTGL_InvoiceByModle(table);
|
||||
Count = q.Count();
|
||||
if (Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize).ToList();
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return (from x in q
|
||||
join y in Funs.DB.PHTGL_Contract on x.ContractId equals y.ContractId into g
|
||||
from c in g.DefaultIfEmpty()
|
||||
select new
|
||||
{
|
||||
c?.ContractName,
|
||||
c?.ContractNum,
|
||||
c?.Parties,
|
||||
c?.ContractAmount,
|
||||
x.InvoiceId,
|
||||
x.ProjectId,
|
||||
x.ContractId,
|
||||
x.State,
|
||||
x.InvoiceCode,
|
||||
x.InvoiceNumber,
|
||||
x.SellerName,
|
||||
x.InvoiceDate,
|
||||
x.AmountExcludingTax,
|
||||
x.TotalTax,
|
||||
x.Remark,
|
||||
x.ImagePath,
|
||||
x.SellerTaxNumber,
|
||||
x.InvoiceAmount,
|
||||
x.ApproveManJson,
|
||||
x.CreateDate,
|
||||
x.CreateUser,
|
||||
x.OrderInDate,
|
||||
x.OrderOutDate,
|
||||
x.OrderCode,
|
||||
x.MaterialRequisitionUnit
|
||||
});
|
||||
}
|
||||
|
||||
public static IEnumerable GetOrderInListData(Model.PHTGL_Invoice table, Grid grid1)
|
||||
{
|
||||
var q = GetPHTGL_InvoiceByModle(table);
|
||||
Count = q.Count();
|
||||
if (Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize).ToList();
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return (from x in q
|
||||
join y in Funs.DB.PHTGL_Contract on x.ContractId equals y.ContractId into g
|
||||
from c in g.DefaultIfEmpty()
|
||||
where x.State>StateDataIn
|
||||
select new
|
||||
{
|
||||
c?.ContractName,
|
||||
c?.ContractNum,
|
||||
c?.Parties,
|
||||
c?.ContractAmount,
|
||||
x.InvoiceId,
|
||||
x.ProjectId,
|
||||
x.ContractId,
|
||||
x.State,
|
||||
x.InvoiceCode,
|
||||
x.InvoiceNumber,
|
||||
x.SellerName,
|
||||
x.InvoiceDate,
|
||||
x.AmountExcludingTax,
|
||||
x.TotalTax,
|
||||
x.Remark,
|
||||
x.ImagePath,
|
||||
x.SellerTaxNumber,
|
||||
x.InvoiceAmount,
|
||||
x.ApproveManJson,
|
||||
x.CreateDate,
|
||||
x.CreateUser,
|
||||
x.OrderInDate,
|
||||
x.OrderOutDate,
|
||||
x.OrderCode,
|
||||
x.MaterialRequisitionUnit
|
||||
}).ToList();
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static Model.PHTGL_Invoice GetPHTGL_InvoiceById(string InvoiceId)
|
||||
{
|
||||
return Funs.DB.PHTGL_Invoice.FirstOrDefault(x => x.InvoiceId == InvoiceId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加实体
|
||||
/// </summary>
|
||||
/// <param name="newtable"></param>
|
||||
public static void AddPHTGL_Invoice(Model.PHTGL_Invoice newtable)
|
||||
{
|
||||
|
||||
Model.PHTGL_Invoice table = new Model.PHTGL_Invoice
|
||||
{
|
||||
InvoiceId = newtable.InvoiceId,
|
||||
ProjectId = newtable.ProjectId,
|
||||
ContractId = newtable.ContractId,
|
||||
State = newtable.State,
|
||||
InvoiceCode = newtable.InvoiceCode,
|
||||
InvoiceNumber = newtable.InvoiceNumber,
|
||||
SellerName = newtable.SellerName,
|
||||
InvoiceDate = newtable.InvoiceDate,
|
||||
AmountExcludingTax = newtable.AmountExcludingTax,
|
||||
TotalTax = newtable.TotalTax,
|
||||
Remark = newtable.Remark,
|
||||
ImagePath = newtable.ImagePath,
|
||||
SellerTaxNumber = newtable.SellerTaxNumber,
|
||||
InvoiceAmount = newtable.InvoiceAmount,
|
||||
ApproveManJson = newtable.ApproveManJson,
|
||||
CreateDate = newtable.CreateDate,
|
||||
CreateUser = newtable.CreateUser,
|
||||
OrderInDate = newtable.OrderInDate,
|
||||
OrderCode = newtable.OrderCode,
|
||||
OrderOutDate = newtable.OrderOutDate,
|
||||
MaterialRequisitionUnit = newtable.MaterialRequisitionUnit,
|
||||
};
|
||||
Funs.DB.PHTGL_Invoice.InsertOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改实体
|
||||
/// </summary>
|
||||
/// <param name="newtable"></param>
|
||||
public static void UpdatePHTGL_Invoice(Model.PHTGL_Invoice newtable)
|
||||
{
|
||||
|
||||
Model.PHTGL_Invoice table = Funs.DB.PHTGL_Invoice.FirstOrDefault(x => x.InvoiceId == newtable.InvoiceId);
|
||||
if (table != null)
|
||||
{
|
||||
table.InvoiceId = newtable.InvoiceId;
|
||||
table.ProjectId = newtable.ProjectId;
|
||||
table.ContractId = newtable.ContractId;
|
||||
table.State = newtable.State;
|
||||
table.InvoiceCode = newtable.InvoiceCode;
|
||||
table.InvoiceNumber = newtable.InvoiceNumber;
|
||||
table.SellerName = newtable.SellerName;
|
||||
table.InvoiceDate = newtable.InvoiceDate;
|
||||
table.AmountExcludingTax = newtable.AmountExcludingTax;
|
||||
table.TotalTax = newtable.TotalTax;
|
||||
table.Remark = newtable.Remark;
|
||||
table.ImagePath = newtable.ImagePath;
|
||||
table.SellerTaxNumber = newtable.SellerTaxNumber;
|
||||
table.InvoiceAmount = newtable.InvoiceAmount;
|
||||
table.ApproveManJson = newtable.ApproveManJson;
|
||||
table.CreateDate = newtable.CreateDate;
|
||||
table.CreateUser = newtable.CreateUser;
|
||||
table.OrderInDate = newtable.OrderInDate;
|
||||
table.OrderCode = newtable.OrderCode;
|
||||
table.OrderOutDate = newtable.OrderOutDate;
|
||||
table.MaterialRequisitionUnit = newtable.MaterialRequisitionUnit;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 删除实体
|
||||
/// </summary>
|
||||
/// <param name="InvoiceId"></param>
|
||||
public static void DeletePHTGL_InvoiceById(string InvoiceId)
|
||||
{
|
||||
|
||||
Model.PHTGL_Invoice table = Funs.DB.PHTGL_Invoice.FirstOrDefault(x => x.InvoiceId == InvoiceId);
|
||||
if (table != null)
|
||||
{
|
||||
Funs.DB.PHTGL_Invoice.DeleteOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据主键获取审批人实体
|
||||
/// </summary>
|
||||
/// <param name="InvoiceId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.PHTGL_InvoiceApproveManEntity GetInvoiceApproveManEntity(string InvoiceId)
|
||||
{
|
||||
Model.PHTGL_InvoiceApproveManEntity list = new Model.PHTGL_InvoiceApproveManEntity();
|
||||
Model.PHTGL_Invoice data = Funs.DB.PHTGL_Invoice.FirstOrDefault(e => e.InvoiceId == InvoiceId);
|
||||
if (data != null && !string .IsNullOrEmpty(data.ApproveManJson))
|
||||
{
|
||||
list = Newtonsoft.Json.JsonConvert.DeserializeObject<Model.PHTGL_InvoiceApproveManEntity>(data.ApproveManJson);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
/// <summary>
|
||||
/// 将状态改为已创建
|
||||
/// </summary>
|
||||
/// <param name="invoiceId"></param>
|
||||
public static void ChangeStateToCreate(string invoiceId)
|
||||
{
|
||||
var model = GetPHTGL_InvoiceById(invoiceId);
|
||||
model.State = StateCreate;
|
||||
UpdatePHTGL_Invoice(model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存入库审批人实体
|
||||
/// </summary>
|
||||
/// <param name="invoiceId"></param>
|
||||
/// <param name="inputapproveman"></param>
|
||||
public static void SaveInputApproveManEntity(string invoiceId, Inputapproveman inputapproveman)
|
||||
{
|
||||
var table = GetInvoiceApproveManEntity(invoiceId);
|
||||
table.InputApproveMan = inputapproveman;
|
||||
var json = Newtonsoft.Json.JsonConvert.SerializeObject(table);
|
||||
var data = Funs.DB.PHTGL_Invoice.FirstOrDefault(e => e.InvoiceId == invoiceId);
|
||||
if (data != null)
|
||||
{
|
||||
data.ApproveManJson = json;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 保存出库审批人实体
|
||||
/// </summary>
|
||||
/// <param name="invoiceId"></param>
|
||||
/// <param name="outputapproveman"></param>
|
||||
public static void SaveOutputApproveManEntity(string invoiceId, Outputapproveman outputapproveman)
|
||||
{
|
||||
var table = GetInvoiceApproveManEntity(invoiceId);
|
||||
table.OutputApproveMan = outputapproveman;
|
||||
var json = Newtonsoft.Json.JsonConvert.SerializeObject(table);
|
||||
var data = Funs.DB.PHTGL_Invoice.FirstOrDefault(e => e.InvoiceId == invoiceId);
|
||||
if (data != null)
|
||||
{
|
||||
data.ApproveManJson = json;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导入数据
|
||||
/// </summary>
|
||||
/// <param name="path">文件地址</param>
|
||||
/// <param name="projectid">项目id</param>
|
||||
/// <param name="creatUserId">创建人id</param>
|
||||
/// <returns></returns>
|
||||
public static ResponeData ImportData(string path, string projectid, string creatUserId)
|
||||
{
|
||||
var responeData = new ResponeData();
|
||||
List<PHTGL_InvoiceDtoIn> temeplateDtoIns;
|
||||
try
|
||||
{
|
||||
temeplateDtoIns = MiniExcel.Query<PHTGL_InvoiceDtoIn>(path, startCell: "A2").ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "模板错误:" + ex.ToString();
|
||||
return responeData;
|
||||
}
|
||||
//数据校验
|
||||
if (temeplateDtoIns.Count == 0)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "导入数据为空!";
|
||||
return responeData;
|
||||
}
|
||||
|
||||
var invoiceCodeList = temeplateDtoIns.Select(x => x.InvoiceCode).Distinct().ToList(); //获取所有发票代码
|
||||
//根据发票代码分组插入数据
|
||||
foreach (var invoiceCode in invoiceCodeList)
|
||||
{
|
||||
var invoiceCodeDtoIns = temeplateDtoIns.Where(x => x.InvoiceCode == invoiceCode).ToList();
|
||||
|
||||
var mapper =
|
||||
ObjectMapperManager.DefaultInstance.GetMapper<List<PHTGL_InvoiceDtoIn>, List<PHTGL_Invoice>>();
|
||||
var mapperDetail =
|
||||
ObjectMapperManager.DefaultInstance.GetMapper<List<PHTGL_InvoiceDtoIn>, List<PHTGL_InvoiceDetail>>();
|
||||
//通过映射实体赋值
|
||||
var invoiceModel = mapper.Map(invoiceCodeDtoIns).FirstOrDefault();
|
||||
var invoceDetailList = mapperDetail.Map(invoiceCodeDtoIns.Where(x => !string.IsNullOrEmpty(x.GoodsOrServicesName) && !string.IsNullOrEmpty(x.SpecificationModel)).ToList());
|
||||
|
||||
var queryModel = new PHTGL_Invoice
|
||||
{
|
||||
InvoiceCode = invoiceCode,
|
||||
ProjectId = projectid
|
||||
};
|
||||
var queryresult = GetPHTGL_InvoiceByModle(queryModel).FirstOrDefault();//查询该发票代码是否存在
|
||||
if (queryresult != null)
|
||||
{
|
||||
if (queryresult.State != StateDataIn)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
invoiceModel.State = StateDataIn;
|
||||
invoiceModel.ProjectId = projectid;
|
||||
invoiceModel.InvoiceId = queryresult.InvoiceId;
|
||||
invoiceModel.CreateUser = creatUserId;
|
||||
invoiceModel.CreateDate = DateTime.Now;
|
||||
UpdatePHTGL_Invoice(invoiceModel);
|
||||
}
|
||||
else
|
||||
{
|
||||
invoiceModel.InvoiceId = SQLHelper.GetNewID();
|
||||
invoiceModel.State = StateDataIn;
|
||||
invoiceModel.ProjectId = projectid;
|
||||
invoiceModel.CreateUser = creatUserId;
|
||||
invoiceModel.CreateDate = DateTime.Now;
|
||||
AddPHTGL_Invoice(invoiceModel);
|
||||
|
||||
}
|
||||
PhtglInvoicedetailService.DeletePHTGL_InvoiceDetailByInvoiceId(invoiceModel.InvoiceId);
|
||||
PhtglInvoicedetailService.BatchAddPHTGL_InvoiveDetail(invoceDetailList, invoiceModel.InvoiceId); //插入发票明细
|
||||
|
||||
}
|
||||
return responeData;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取审批人员
|
||||
/// </summary>
|
||||
/// <param name="invoiceId">主键id</param>
|
||||
/// <param name="type">0 入库 1出库</param>
|
||||
/// <returns></returns>
|
||||
public static List<ApproveManModel> GetApproveManModels(string invoiceId ,int type)
|
||||
{
|
||||
List<ApproveManModel> approveManModels = new List<ApproveManModel>();
|
||||
var table = GetInvoiceApproveManEntity(invoiceId);
|
||||
|
||||
if (type==0) //入库
|
||||
{
|
||||
approveManModels.Add(new ApproveManModel { Number = 1, userid = table.InputApproveMan.ProfessionalEngineer, Rolename = "专业工程师" });
|
||||
approveManModels.Add(new ApproveManModel { Number = 2, userid = table.InputApproveMan.ConstructionManager, Rolename = "施工经理" });
|
||||
approveManModels.Add(new ApproveManModel { Number = 3, userid = table.InputApproveMan.ControlManager, Rolename = "控制经理" });
|
||||
approveManModels.Add(new ApproveManModel { Number = 4, userid = table.InputApproveMan.ProjectManager, Rolename = "项目经理" }); }
|
||||
else {
|
||||
approveManModels.Add(new ApproveManModel { Number = 5, userid = table.OutputApproveMan.PurchasingMan, Rolename = "采购员" });
|
||||
approveManModels.Add(new ApproveManModel { Number = 6, userid = table.OutputApproveMan.ControlManager, Rolename = "控制经理" });
|
||||
approveManModels.Add(new ApproveManModel { Number = 7, userid = table.OutputApproveMan.ProjectManager, Rolename = "项目经理" });
|
||||
approveManModels.Add(new ApproveManModel { Number = 8, userid = table.OutputApproveMan.ConUnitMaterialOfficer, Rolename = "施工单位材料经理" });
|
||||
approveManModels.Add(new ApproveManModel { Number = 9, userid = table.OutputApproveMan.ConUnitProjectManager, Rolename = "施工单位项目经理" });
|
||||
}
|
||||
|
||||
|
||||
return approveManModels;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 开启审批流程
|
||||
/// </summary>
|
||||
/// <param name="invoiceId"></param>
|
||||
public static void StartApprovalProcess(string invoiceId )
|
||||
{
|
||||
|
||||
var model = GetPHTGL_InvoiceById(invoiceId);
|
||||
if (model.State ==StateCreate || model.State == StateInPutApproveRefuse)
|
||||
{
|
||||
CreateFirstApprove(invoiceId, 0);
|
||||
model.State = StateInPutApprove;
|
||||
UpdatePHTGL_Invoice(model);
|
||||
}
|
||||
else if (model.State == StateInPutApproveSuccess || model.State == StateOutPutApproveRefuse)
|
||||
{
|
||||
CreateFirstApprove(invoiceId, 1);
|
||||
model.State = StateOutPutApprove;
|
||||
UpdatePHTGL_Invoice(model);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建第一个审批流程
|
||||
/// </summary>
|
||||
/// <param name="invoiceId">主键</param>
|
||||
/// <param name="type">0 入库 1出库</param>
|
||||
public static void CreateFirstApprove(string invoiceId, int type)
|
||||
{
|
||||
var approveManModels = GetApproveManModels(invoiceId, type).OrderBy(x=>x.Number).FirstOrDefault();
|
||||
Model.PHTGL_Approve _Approve = new Model.PHTGL_Approve();
|
||||
_Approve.ApproveId = SQLHelper.GetNewID(typeof(Model.PHTGL_Approve));
|
||||
_Approve.ContractId = invoiceId;
|
||||
_Approve.ApproveMan = approveManModels.userid;
|
||||
_Approve.ApproveDate = "";
|
||||
_Approve.State = 0;
|
||||
_Approve.IsAgree = 0;
|
||||
_Approve.ApproveIdea = "";
|
||||
_Approve.ApproveType = approveManModels.Rolename;
|
||||
_Approve.ApproveForm =(type==0? "Invoice_Input": "Invoice_Output");
|
||||
BLL.PHTGL_ApproveService.AddPHTGL_Approve(_Approve);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 审批
|
||||
/// </summary>
|
||||
/// <param name="invoiceId"></param>
|
||||
/// <param name="userid"></param>
|
||||
/// <param name="isAgree"></param>
|
||||
/// <param name="idea"></param>
|
||||
/// <param name="type">0 入库 1出库</param>
|
||||
public static void Approve(string invoiceId, int type, string userid, bool isAgree, string idea)
|
||||
{
|
||||
var approveManModels = GetApproveManModels(invoiceId, type); //获取审批人员
|
||||
var thisApprovemodel = PHTGL_ApproveService.GetPHTGL_ApproveByUserId(invoiceId, userid);//获取当前人员正在审批的信息
|
||||
if (thisApprovemodel == null) { return; }
|
||||
var thisApproveTypeNumber = approveManModels.Find(x => x.userid == userid && x.Rolename == thisApprovemodel.ApproveType).Number; //当前审批人员序号
|
||||
int nextApproveTypeNumber = thisApproveTypeNumber + 1; //下一个审批人员序号
|
||||
int maxApproveTypeNumber = approveManModels.Max(x => x.Number); //最大审批人员序号
|
||||
|
||||
|
||||
thisApprovemodel.ApproveDate = Funs.GetNewDateTimeOrNow("").ToString();
|
||||
thisApprovemodel.IsAgree = isAgree ? 2 : 1;
|
||||
thisApprovemodel.ApproveIdea = idea;
|
||||
thisApprovemodel.State = 1;
|
||||
PHTGL_ApproveService.UpdatePHTGL_Approve(thisApprovemodel);
|
||||
if (isAgree)
|
||||
{
|
||||
if (PHTGL_ApproveService.GetPHTGL_ApproveByContractId(invoiceId).Count==0) //当前节点是否全部审批结束
|
||||
{
|
||||
if (thisApproveTypeNumber < maxApproveTypeNumber) //是否最末节点
|
||||
{
|
||||
Model.PHTGL_Approve _Approve = new Model.PHTGL_Approve();
|
||||
_Approve.ContractId = thisApprovemodel.ContractId;
|
||||
_Approve.ApproveMan = approveManModels.Find(e => e.Number == nextApproveTypeNumber).userid;
|
||||
_Approve.ApproveDate = "";
|
||||
_Approve.State = 0;
|
||||
_Approve.IsAgree = 0;
|
||||
_Approve.ApproveIdea = "";
|
||||
_Approve.ApproveType = approveManModels.Find(e => e.Number == nextApproveTypeNumber).Rolename;
|
||||
_Approve.IsPushOa = 0;
|
||||
_Approve.ApproveForm = (type == 0 ? "Invoice_Input" : "Invoice_Output");
|
||||
_Approve.ApproveId = SQLHelper.GetNewID(typeof(Model.PHTGL_Approve));
|
||||
BLL.PHTGL_ApproveService.AddPHTGL_Approve(_Approve);
|
||||
}
|
||||
else
|
||||
{
|
||||
//流程走完结束
|
||||
var model = GetPHTGL_InvoiceById(invoiceId);
|
||||
model.State = (type == 0 ? StateInPutApproveSuccess:StateOutPutApproveSuccess);
|
||||
UpdatePHTGL_Invoice(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //审批拒绝-流程结束
|
||||
var model = GetPHTGL_InvoiceById(invoiceId);
|
||||
model.State = (type == 0 ? StateInPutApproveRefuse : StateOutPutApproveRefuse);
|
||||
UpdatePHTGL_Invoice(model);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
using FineUIPro;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
|
||||
public static class PhtglInvoicedetailService
|
||||
{
|
||||
|
||||
|
||||
|
||||
#region 获取列表
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
/// </summary>
|
||||
public static int Count
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public static IEnumerable<Model.PHTGL_InvoiceDetail> GetPHTGL_InvoiceDetailByModle(Model.PHTGL_InvoiceDetail table)
|
||||
{
|
||||
var q = from x in Funs.DB.PHTGL_InvoiceDetail
|
||||
where
|
||||
(string.IsNullOrEmpty(table.InvoiceDetailId) || x.InvoiceDetailId.Contains(table.InvoiceDetailId)) &&
|
||||
(string.IsNullOrEmpty(table.InvoiceId) || x.InvoiceId.Contains(table.InvoiceId)) &&
|
||||
(string.IsNullOrEmpty(table.GoodsOrServicesName) || x.GoodsOrServicesName.Contains(table.GoodsOrServicesName)) &&
|
||||
(string.IsNullOrEmpty(table.SpecificationModel) || x.SpecificationModel.Contains(table.SpecificationModel)) &&
|
||||
(string.IsNullOrEmpty(table.Unit) || x.Unit.Contains(table.Unit)) &&
|
||||
(string.IsNullOrEmpty(table.TaxRate) || x.TaxRate.Contains(table.TaxRate))
|
||||
select x
|
||||
;
|
||||
|
||||
return q.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取分页列表
|
||||
/// </summary>
|
||||
/// <param name="table"></param>
|
||||
/// <param name="grid1"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable GetListData(Model.PHTGL_InvoiceDetail table, Grid grid1)
|
||||
{
|
||||
var q = GetPHTGL_InvoiceDetailByModle(table);
|
||||
Count = q.Count();
|
||||
if (Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize).ToList();
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return from x in q
|
||||
select new
|
||||
{
|
||||
x.InvoiceDetailId,
|
||||
x.InvoiceId,
|
||||
x.GoodsOrServicesName,
|
||||
x.SpecificationModel,
|
||||
x.Unit,
|
||||
x.Quantity,
|
||||
x.UnitPrice,
|
||||
x.Amount,
|
||||
x.TaxRate,
|
||||
x.Tax,
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static Model.PHTGL_InvoiceDetail GetPHTGL_InvoiceDetailById(string InvoiceDetailId)
|
||||
{
|
||||
return Funs.DB.PHTGL_InvoiceDetail.FirstOrDefault(x => x.InvoiceDetailId == InvoiceDetailId);
|
||||
}
|
||||
public static List<Model.PHTGL_InvoiceDetail> GetPHTGL_InvoiceDetailByInvoiceId(string InvoiceId)
|
||||
{
|
||||
var list = Funs.DB.PHTGL_InvoiceDetail.Where(x => x.InvoiceId == InvoiceId).ToList();
|
||||
return list;
|
||||
}
|
||||
public static void AddPHTGL_InvoiceDetail(Model.PHTGL_InvoiceDetail newtable)
|
||||
{
|
||||
if (string.IsNullOrEmpty(newtable.InvoiceDetailId))
|
||||
{
|
||||
newtable.InvoiceDetailId = SQLHelper.GetNewID();
|
||||
}
|
||||
Model.PHTGL_InvoiceDetail table = new Model.PHTGL_InvoiceDetail
|
||||
{
|
||||
InvoiceDetailId = newtable.InvoiceDetailId,
|
||||
InvoiceId = newtable.InvoiceId,
|
||||
GoodsOrServicesName = newtable.GoodsOrServicesName,
|
||||
SpecificationModel = newtable.SpecificationModel,
|
||||
Unit = newtable.Unit,
|
||||
Quantity = newtable.Quantity,
|
||||
UnitPrice = newtable.UnitPrice,
|
||||
Amount = newtable.Amount,
|
||||
TaxRate = newtable.TaxRate,
|
||||
Tax = newtable.Tax,
|
||||
};
|
||||
Funs.DB.PHTGL_InvoiceDetail.InsertOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
public static void UpdatePHTGL_InvoiceDetail(Model.PHTGL_InvoiceDetail newtable)
|
||||
{
|
||||
|
||||
Model.PHTGL_InvoiceDetail table = Funs.DB.PHTGL_InvoiceDetail.FirstOrDefault(x => x.InvoiceDetailId == newtable.InvoiceDetailId);
|
||||
if (table != null)
|
||||
{
|
||||
table.InvoiceDetailId = newtable.InvoiceDetailId;
|
||||
table.InvoiceId = newtable.InvoiceId;
|
||||
table.GoodsOrServicesName = newtable.GoodsOrServicesName;
|
||||
table.SpecificationModel = newtable.SpecificationModel;
|
||||
table.Unit = newtable.Unit;
|
||||
table.Quantity = newtable.Quantity;
|
||||
table.UnitPrice = newtable.UnitPrice;
|
||||
table.Amount = newtable.Amount;
|
||||
table.TaxRate = newtable.TaxRate;
|
||||
table.Tax = newtable.Tax;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
public static void DeletePHTGL_InvoiceDetailById(string InvoiceDetailId)
|
||||
{
|
||||
|
||||
Model.PHTGL_InvoiceDetail table = Funs.DB.PHTGL_InvoiceDetail.FirstOrDefault(x => x.InvoiceDetailId == InvoiceDetailId);
|
||||
if (table != null)
|
||||
{
|
||||
Funs.DB.PHTGL_InvoiceDetail.DeleteOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void DeletePHTGL_InvoiceDetailByInvoiceId(string InvoiceId)
|
||||
{
|
||||
var list = Funs.DB.PHTGL_InvoiceDetail.Where(x => x.InvoiceId == InvoiceId);
|
||||
if (list != null)
|
||||
{
|
||||
Funs.DB.PHTGL_InvoiceDetail.DeleteAllOnSubmit(list);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
public static void BatchAddPHTGL_InvoiveDetail(IEnumerable<Model.PHTGL_InvoiceDetail> list, string invoiceId )
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
item.InvoiceId= invoiceId;
|
||||
AddPHTGL_InvoiceDetail(item);
|
||||
}
|
||||
}
|
||||
public static void BatchAddPHTGL_InvoiveDetail(IEnumerable<Model.PHTGL_InvoiceDetail> list)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
AddPHTGL_InvoiceDetail(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user