public string fnInsert(ReceiveD receiveD) { string sSql = " INSERT INTO [MNDTreceive_details] " + " ([seq] " + " ,[order_id] " + " ,[material_id] " + " ,[warehouse_id] " + " ,[amount] " + " ,[price] " + " ,[complete] " + " ,[pay_complete] " + " ,[description] " + " ,[create_id] " + " ,[create_datetime] " + " ,[modify_id] " + " ,[modify_datetime]) " + " VALUES " + " ('" + receiveD.seq + "' " + " ,'" + receiveD.order_id + "' " + " ,'" + receiveD.material_id + "' " + " ,'" + receiveD.warehouse_id + "' " + " ,'" + receiveD.amount + "' " + " ,'" + receiveD.price + "' " + " ,'N' " + " ,'N' " + " ,'" + receiveD.description + "' " + " ,'" + receiveD.create_id + "' " + " ,GETDATE() " + " ,'" + receiveD.create_id + "' " + " ,GETDATE()) "; return(PublicApi.fnExecuteSQL(sSql, "MNDT")); }
// iPage 第N頁 // iSize 最大顯示數量 public DataTable fnSelects(ReceiveD receiveD, int iPage, int iSize) { int iStart = (iPage - 1) * iSize + 1; int iEnd = iPage * iSize; string sCondition = ""; sCondition += PublicApi.fnAddCondition("[order_id]", receiveD.order_id); string sInquireSql = " SELECT [receive_d].[seq], " + " [receive_d].[material_id], " + " [receive_d].[warehouse_id], " + " [receive_d].[amount], " + " [receive_d].[price], " + " CASE [receive_d].[complete] WHEN 'Y' THEN 'checked' ELSE '' END [complete], " + " CASE [receive_d].[pay_complete] WHEN 'Y' THEN 'checked' ELSE '' END [pay_complete], " + " [receive_d].[description] " + " FROM (SELECT Row_number() OVER (ORDER BY [seq] ASC) NUM, " + " * " + " FROM [MNDTreceive_details] " + " WHERE 1 = 1 " + sCondition + ") AS [receive_d] " + " WHERE NUM BETWEEN " + iStart.ToString() + " AND " + iEnd.ToString() + " "; return(PublicApi.fnGetDt(sInquireSql, "MNDT")); }
public string fnDelete(ReceiveD receiveD) { string sSql = " DELETE [MNDTreceive_details] " + " WHERE [order_id] = '" + receiveD.order_id + "' " + " AND [seq] = '" + receiveD.seq + "' "; return(PublicApi.fnExecuteSQL(sSql, "MNDT")); }
public string fnSelectAllAmount(ReceiveD receiveD) { string sSql = " SELECT ISNULL(SUM([amount]), '0') " + " FROM [MNDTreceive_details] " + " WHERE [order_id] = '" + receiveD.order_id + "' " + " AND [material_id] = '" + receiveD.material_id + "' "; return(PublicApi.fnGetValue(sSql, "MNDT")); }
public string fnAudits(ReceiveD receiveD) { string sSql = " UPDATE [MNDTreceive_details] " + " SET [complete] = '" + receiveD.complete + "' " + " ,[modify_id] = '" + receiveD.create_id + "' " + " ,[modify_datetime] = GETDATE() " + " WHERE [order_id] = '" + receiveD.order_id + "' "; return(PublicApi.fnExecuteSQL(sSql, "MNDT")); }
public string fnGetSeq(ReceiveD receiveD) { string sCondition = ""; sCondition += PublicApi.fnAddCondition("[order_id]", receiveD.order_id); string sSql = " SELECT ISNULL(MAX([seq]), 0) + 1 " + " FROM [MNDTreceive_details] AS [receive_d] " + " WHERE 1 = 1 " + sCondition; return(PublicApi.fnGetValue(sSql, "MNDT")); }
public string fnCount(ReceiveD receiveD) { string sCondition = ""; sCondition += PublicApi.fnAddCondition("[order_id]", receiveD.order_id); string sCountSql = " SELECT COUNT([order_id]) " + " FROM [MNDTreceive_details] " + " WHERE 1 = 1 " + sCondition; string sPageSize = PublicApi.fnGetValue(sCountSql, "MNDT"); return(sPageSize); }
public DataTable fnSelect(ReceiveD receiveD) { string sCondition = ""; sCondition += PublicApi.fnAddCondition("[order_id]", receiveD.order_id); sCondition += PublicApi.fnAddCondition("[seq]", receiveD.seq); string sInquireSql = " SELECT [receive_d].* " + " FROM [MNDTreceive_details] AS [receive_d] " + " WHERE 1 = 1 " + sCondition; return(PublicApi.fnGetDt(sInquireSql, "MNDT")); }
public bool fnIsExist(ReceiveD receiveD) { string sCondition = ""; if (receiveD.seq != null && receiveD.seq.Length > 0) { sCondition += " AND [seq] <> " + receiveD.seq; } string sSql = " SELECT COUNT([material_id]) " + " FROM [MNDTreceive_details] " + " WHERE [order_id] = '" + receiveD.order_id + "' " + " AND [material_id] = '" + receiveD.material_id + "' " + " AND [warehouse_id] = '" + receiveD.warehouse_id + "' " + sCondition; return(PublicApi.fnGetValue(sSql, "MNDT") == "1"); }
public string fnUpdate(ReceiveD receiveD) { string sSql = " UPDATE [MNDTreceive_details] " + " SET [material_id] = '" + receiveD.material_id + "' " + " ,[warehouse_id] = '" + receiveD.warehouse_id + "' " + " ,[amount] = '" + receiveD.amount + "' " + " ,[price] = '" + receiveD.price + "' " + " ,[complete] = '" + receiveD.complete + "' " + " ,[pay_complete] = '" + receiveD.pay_complete + "' " + " ,[description] = '" + receiveD.description + "' " + " ,[modify_id] = '" + receiveD.create_id + "' " + " ,[modify_datetime] = GETDATE() " + " WHERE [order_id] = '" + receiveD.order_id + "' " + " AND [seq] = '" + receiveD.seq + "' "; return(PublicApi.fnExecuteSQL(sSql, "MNDT")); }
public DataTable fnSelects(ReceiveD receiveD) { string sCondition = ""; sCondition += PublicApi.fnAddCondition("[order_id]", receiveD.order_id); string sInquireSql = " SELECT [receive_d].[seq], " + " [receive_d].[material_id], " + " [receive_d].[warehouse_id], " + " [receive_d].[amount], " + " [receive_d].[price], " + " CASE [receive_d].[complete] WHEN 'Y' THEN 'checked' ELSE '' END [complete], " + " CASE [receive_d].[pay_complete] WHEN 'Y' THEN 'checked' ELSE '' END [pay_complete], " + " [receive_d].[description] " + " FROM [MNDTreceive_details] AS [receive_d] " + " WHERE 1 = 1 " + sCondition; return(PublicApi.fnGetDt(sInquireSql, "MNDT")); }