This commit is contained in:
gongxh
2022-01-05 15:02:44 +08:00
parent cf9c8ae8a5
commit 7e7a737b78

View File

@@ -432,8 +432,9 @@ namespace NX.ERP.U8
strSQL = "SELECT iInvNCost,iInvSPrice,iInvRCost,iImpTaxRate FROM Inventory WITH(NOLOCK) WHERE cInvCode = '" + cInvCode + "'"; strSQL = "SELECT iInvNCost,iInvSPrice,iInvRCost,iImpTaxRate FROM Inventory WITH(NOLOCK) WHERE cInvCode = '" + cInvCode + "'";
cost = conn.Query<InvCost>(strSQL, null).FirstOrDefault(); cost = conn.Query<InvCost>(strSQL, null).FirstOrDefault();
var date = DateTime.Today.AddMonths(-1);
strSQL = $@" SELECT (CASE WHEN convert(decimal(36,3),isnull(inum,0))=0 then 0 else iMoney / iNum END) AS iPrice strSQL = $@" SELECT (CASE WHEN convert(decimal(36,3),isnull(inum,0))=0 then 0 else iMoney / iNum END) AS iPrice
from IA_Summary WHERE cWhCode='{whCode}' AND cInvCode='{cInvCode}' AND iMonth={DateTime.Today.Month - 1} and iyear ={DateTime.Today.Year}"; from IA_Summary WHERE cWhCode='{whCode}' AND cInvCode='{cInvCode}' AND iMonth={date.Month} and iyear ={date.Year}";
_cost = conn.ExecuteScalar<double>(strSQL, null, null, 10, System.Data.CommandType.Text); _cost = conn.ExecuteScalar<double>(strSQL, null, null, 10, System.Data.CommandType.Text);
} }