package com.steering.pss.crm.server;

import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;
import CoreFS.Util.StringUtils;
import com.steering.comm.converter.CoreConverter;
import com.steering.comm.db.DBCommon;

public class CrmBillAllServer extends DBCommon {

    public CoreReturnObject CrmBillMQuery(String billNo,String orderNo, String startDate, String endDate) {
        String sql = CoreXmlSqlParsersFactory.getSql("CrmBillAllServer.CrmBillMQuery");
        if (!StringUtils.isEmpty(billNo)) {
            sql += " AND T.BILL_NO = '" + billNo + "'";
        }
        if (!StringUtils.isEmpty(orderNo)) {
            sql += " AND T.ORDER_NO = '" + orderNo + "'";
        }
        if (!StringUtils.isEmpty(startDate) && !StringUtils.isEmpty(endDate)) {
            sql += " AND T.CREATE_TIME BETWEEN to_date('" + startDate + "','yyyy-MM-dd HH24:MI:SS') AND to_date('" + endDate + "','yyyy-MM-dd HH24:MI:SS')";
        }
        sql += " ORDER BY T.CREATE_TIME,T.BILL_NO";
        return this.getData(sql);
    }

    public CoreReturnObject CrmBillCQuery(String[] billNos) {
        String sql = CoreXmlSqlParsersFactory.getSql("CrmBillAllServer.CrmBillCQuery");
        sql += " AND (" + CoreConverter.toSqlConditionString1000("T.BILL_NO", billNos) + ")";
        sql += " ORDER BY T.CREATE_TIME";
        return this.getData(sql);
    }

}
