2014年2月12日 星期三

採購單Q1

採購單 在列印E 在打單時只要品項使用插入的功能 列印E的頁面 只會從最末端商品後開始加入並無法像同採購頁面 出現實際插入的順序


select * From Systems
selecT * from PubFunction where i_system = 'A00000000005'
採購訂單 TFormPurOrder

SELECT OP.i_no OPi_no,OP.i_actDate OPi_actDate,OP.i_mark OPi_mark,OP.i_countryCode OPi_countryCode,OP.i_taxType OPi_taxType,OP.i_taxRate OPi_taxRate,OP.i_supplier OPi_supplier,OP.i_currency OPi_currency,OP.i_priceType OPi_priceType,OP.i_exchangeRate OPi_exchangeRate,OP.i_lcNo OPi_lcNo,OP.i_effect OPi_effect,OP.i_cancel OPi_cancel,OP.i_validDate OPi_validDate,OP.i_term OPi_term,OP.i_tradeCondition OPi_tradeCondition,OP.i_deliveryCondition OPi_deliveryCondition,OP.i_type1 OPi_type1,OP.i_type2 OPi_type2,OP.i_hasNo OPi_hasNo,OP.i_purchaser OPi_purchaser,OP.i_clerk OPi_clerk,OP.i_valid OPi_valid,OP.i_checker OPi_checker,OP.i_manager OPi_manager,OP.i_company OPi_company,S.i_no Si_no,S.i_name Si_name,C.i_nameE Ci_nameE,OP.i_pactMemo OPi_pactMemo,OP.i_depot OPi_depot,DOT.i_name DOTi_name,OP.i_shipAddress OPi_shipAddress,OP.i_perCent1 OPi_perCent1,OP.i_perCent2 OPi_perCent2,OP.i_perCent3 OPi_perCent3,OP.i_perCent4 OPi_perCent4,OP.i_fromPort OPi_fromPort,OP.i_toPort OPi_toPort,OP.i_memo OPi_memo,OP.i_linkMan OPi_linkMan,SM.i_saleMarker SMi_saleMarker ,SM.i_frontMarker SMi_frontMarker,SM.i_sideMarker SMi_sideMarker, C.i_name Ci_name,PTC.i_no PTCi_no,PTC.i_memo PTCi_memo,PT.i_no PTi_no,PT.i_name PTi_name,E.i_no Ei_no, E.i_name Ei_name ,PDC.i_no PDCi_no,PDC.i_name PDCi_name ,OP.i_shipType OPi_shipType,OP.i_carryDate OPi_carryDate,OP.i_arriveDate OPi_arriveDate, OP.i_shipDate OPi_shipDate,OP.i_balanceDate OPi_balanceDate,OP.i_exchangePort OPi_exchangePort, OP.i_shipName OPi_shipName,OP.i_shipAgent OPi_shipAgeng,OP.i_madeIn OPi_madeIn, OP.i_shipLine OPi_shipLine,OP.i_safeItem OPi_safeItem,OP.i_markName OPi_markName ,OP.i_statusType OPi_statusType ,EM.i_no EMi_no, EM.i_name EMi_name ,Dt.i_no Dti_no,Dt.i_name Dti_name ,OP.i_conFile FROM PurOrderPact OP LEFT OUTER JOIN Supplier S ON S.i_supplier=OP.i_supplier LEFT OUTER JOIN Currency C ON C.i_currency=OP.i_currency LEFT OUTER JOIN PurTradeCondition PTC ON PTC.i_tradeCondition=OP.i_tradeCondition LEFT OUTER JOIN PurTerm PT ON PT.i_term = OP.i_term LEFT OUTER JOIN PurDeliveryCondition PDC ON PDC.i_deliveryCondition=OP.i_deliveryCondition LEFT OUTER JOIN Purchaser P ON P.i_purchaserPK = OP.i_purchaser LEFT OUTER JOIN Employee E ON E.i_employee = P.i_purchaser LEFT OUTER JOIN SaleMarker SM ON SM.i_saleMarker = OP.i_saleHead  LEFT OUTER JOIN Dept Dt ON Dt.i_dept = OP.i_dept  LEFT OUTER JOIN Employee EM ON EM.i_employee = OP.i_purChaserMan  LEFT OUTER JOIN Depot DOT ON DOT.i_depot = OP.i_depot  WHERE OP.i_purOrderPact = 'A00000000014'
go

SELECT OP.i_seq,OP.i_purOrderIVary OPi_purOrderIVary,OP.i_purDemandPact OPi_purDemandPact,OP.i_item OPi_item,OP.i_remark OPi_remark,OP.i_batch2 OPi_batch2,ICF.i_name ICFi_name,OP.i_supStyle SupStyle,OP.i_unit OPi_unit,OP.i_vol OPi_vol,OP.i_deliveryDate OPi_deliveryDate,OP.i_ctrtPrice OPi_ctrtPrice,OP.i_factPrice OPi_factPrice,OP.i_otherPrice OPi_otherPrice,OP.i_amountUI OPi_amountUI,OP.i_discount OPi_discount,OP.i_seq OPi_seq,OP.i_bomSeqNo OPi_bomSeqNo,OP.i_itemStyle OPi_itemStyle,I.i_no Ii_no, DV.i_demandDate DVi_demandDate,DV.i_vol DVi_vol, OP.i_memo1 OPi_memo1,OP.i_memo2 OPi_memo2,OP.i_memo OPi_memo,  OP.i_batch OPi_batch,OP.i_storePlaceNo OPi_storePlace,OP.i_batch InvBatchMemo_i_name,OP.i_storePlaceNo StorePlace_i_no, OP.i_assignSupplier OPi_assignSupplier,OP.i_assignItem OPi_assignItem,OP.i_saleCase,SC.i_name SCNAME, OP.i_orderNo OPi_orderNo, (case isnull(OP.i_itemName,'') when '' then I.i_name else OP.i_itemName end) Ii_name,OP.i_itemStyle Ii_itemStyle,U.i_name Ui_name
FROM PurOrderIVary OP
           JOIN Item I ON I.i_item = OP.i_item
LEFT OUTER JOIN PurDraftTrace DT ON DT.i_purOrderIVary = OP.i_purOrderIVary
LEFT OUTER JOIN PurDraftVary DV ON DV.i_purDraftVary=DT.i_purDraftVary
LEFT OUTER JOIN Unit U ON U.i_unit = OP.i_unit
LEFT OUTER JOIN InvCaseField ICF ON ICF.i_caseField=OP.i_batch2
LEFT OUTER JOIN SaleCase SC ON SC.i_saleCase=OP.i_saleCase
LEFT OUTER JOIN InvBatchMemo ICF2 ON ICF2.i_batch = OP.i_batch AND ICF2.i_item=OP.i_item
WHERE OP.i_purOrderPact='A00000000014' AND isnull(OP.i_memo1,'')<>'ADD_BY_MOD'  ORDER BY OP.i_seq
go


__fastcall TFormReportPurOrder::TFormReportPurOrder(TComponent* Owner)
        : TFormReportBase(Owner)
{ .......



    m_strVarySQLCmd = " SELECT I.i_no ItemNo,I.i_nameE ItemNameE,Vary.i_itemName ItemName,I.i_itemStyleE ItemStyleE,Vary.i_itemStyle ItemStyle,U.i_name UnitName,"
                      " Vary.i_vol VolUI,Vary.i_factPrice Price,Vary.i_discount Discount,"
                      " Vary.i_amountUI AmountUI,Vary.i_deliveryDate DeliveryDate"
                      " FROM PurOrderIVary Vary "
                      " LEFT JOIN Item I ON Vary.i_item=I.i_item"
                      " LEFT JOIN Unit U ON Vary.i_unit=U.i_unit"
      XXXX WRONG                " ORDER BY Vary.i_seq ";     


}

tow version
 //放表身的行
            int iRow=0;
            strSQLCmd= m_strVarySQLCmd + " WHERE Vary.i_purOrderPact='"+ strPurOrderPk +"'";
            strSQLCmd +=  " ORDER BY Vary.i_seq ";

沒有留言:

張貼留言