@ -774,7 +774,7 @@ namespace ICSSoft.DataProject
{
{
#region ERP
#region ERP
string sql = @ "SELECT c.DepCode+a.ToWarehouseCode+c.MOCode+a.MUSER AS Costre,c.DepCode,a.ToWarehouseCode AS WarehouseCode,c.MOCode,a.MUSER,ROW_NUMBER() OVER (ORDER BY c.DepCode,a.ToWarehouseCode,c.MOCode,c.MODetailID,a.InvCode) AS Sequence,
string sql = @ "SELECT c.DepCode+a.ToWarehouseCode+c.MOCode+a.MUSER AS Costre,c.DepCode,a.ToWarehouseCode AS WarehouseCode,c.MOCode,a.MUSER,ROW_NUMBER() OVER (ORDER BY c.DepCode,a.ToWarehouseCode,c.MOCode,c.MODetailID,a.InvCode) AS Sequence,
a . InvCode , SUM ( a . Quantity ) AS Quantity , 0 AS Amount , c . MODetailID , Enable AS UpdateTodoQuantity
a . InvCode , SUM ( a . Quantity ) AS Quantity , SUM ( a . Quantity ) * ( lot . Amount / lot . Quantity ) AS Amount , c . MODetailID , Enable AS UpdateTodoQuantity
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) AS ProjectCode , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END AS BatchCode , ISNULL ( ext . Version , ' ' ) AS Version , ISNULL ( ext . Brand , ' ' ) AS Brand ,
, a . WorkPoint , ISNULL ( ext . ProjectCode , ' ' ) AS ProjectCode , CASE WHEN ( invBat . BatchEnable IS NULL AND ISNULL ( inv . BatchEnable , '0' ) = '1' ) OR ISNULL ( invBat . BatchEnable , '0' ) = '1' THEN ISNULL ( ext . BatchCode , ' ' ) ELSE ' ' END AS BatchCode , ISNULL ( ext . Version , ' ' ) AS Version , ISNULL ( ext . Brand , ' ' ) AS Brand ,
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10
ISNULL ( ext . cFree1 , ' ' ) AS cFree1 , ISNULL ( ext . cFree2 , ' ' ) AS cFree2 , ISNULL ( ext . cFree3 , ' ' ) AS cFree3 , ISNULL ( ext . cFree4 , ' ' ) AS cFree4 , ISNULL ( ext . cFree5 , ' ' ) AS cFree5 , ISNULL ( ext . cFree6 , ' ' ) AS cFree6 , ISNULL ( ext . cFree7 , ' ' ) AS cFree7 , ISNULL ( ext . cFree8 , ' ' ) AS cFree8 , ISNULL ( ext . cFree9 , ' ' ) AS cFree9 , ISNULL ( ext . cFree10 , ' ' ) AS cFree10
INTO # TempERP
INTO # TempERP