Example #1
0
        public void RunStockCheck(string id)
        {
            LinkSelect linkS = new LinkSelect();

            linkS.TableNames.Add("stockMaterialSettlementDetail");
            linkS.TableNames.Add("stockMaterialSettlement");
            linkS.LinkConds.Add("stockMaterialSettlementDetail.smsId=stockMaterialSettlement.id");
            linkS.TableNames.Add("indent");
            linkS.LinkConds.Add("stockMaterialSettlementDetail.iId=indent.id");
            linkS.TableNames.Add("material");
            linkS.LinkConds.Add("indent.mId=material.id");
            linkS.TableNames.Add("materialName");
            linkS.LinkConds.Add("material.mnId=materialName.id");
            linkS.TableNames.Add("materialModel");
            linkS.LinkConds.Add("material.mmId=materialModel.id");
            linkS.TableNames.Add("materialKind");
            linkS.LinkConds.Add("materialName.mkId=materialKind.id");
            linkS.Viewfields.Add("materialKind.sort");
            linkS.Viewfields.Add("materialName.[name]");
            linkS.Viewfields.Add("materialModel.model");
            linkS.Viewfields.Add("stockMaterialSettlementDetail.[sum] as money");
            linkS.Viewfields.Add("stockMaterialSettlementDetail.count as suttle");
            linkS.Viewfields.Add("indent.unitPrice");
            linkS.Conds.Add("stockMaterialSettlement.id=" + id);
            DataSet ds = linkS.LeftLinkOpen();

            //SqlHelper helper = new SqlHelper();
            //String sql = "Select voitureInfo.[no] as sort,stockContract.[name],stockNote.iId as 合同明细编号,materialName.[name] as 材料名称,materialModel.model,stockNote.grossWeight as 车辆毛重,stockNote.tare as 车辆皮重,stockNote.suttle,site1.site as 起运地,site2.site as 止运地,stockNote.inputdate as 日期时间,stockNote.remark as 备注,stockNote.barCode as 条形码,unitPrice,unitPrice * stockNote.suttle as money From stockMaterialNoteCorresponding Left Outer Join stockNote ON stockMaterialNoteCorresponding.snId=stockNote.id Left Outer Join stockMaterialSettlementDetail ON stockMaterialNoteCorresponding.smsdId=stockMaterialSettlementDetail.id Left Outer Join stockMaterialSettlement ON stockMaterialSettlementDetail.smsId=stockMaterialSettlement.id Left Outer Join stockContract ON stockMaterialSettlement.scId=stockContract.id Left Outer Join voitureInfo ON stockNote.viId=voitureInfo.id Left Outer Join transportUnit ON voitureInfo.tuId=transportUnit.id Left Outer Join site site1 ON stockNote.sId1=site1.id Left Outer Join site site2 ON stockNote.sId2=site2.id Left Outer Join transportGoodsInformationCorresponding ON stockNote.tgicId=transportGoodsInformationCorresponding.id Left Outer Join transportContract ON transportGoodsInformationCorresponding.tcId=transportContract.id Left Outer Join indent ON stockNote.iId=indent.id Left Outer Join material ON indent.mId=material.id Left Outer Join materialName ON material.mnId=materialName.id Left Outer Join materialModel ON material.mmId=materialModel.id where 1=1  ";
            //System.Collections.ArrayList oArrayList = new System.Collections.ArrayList();
            //oArrayList.Add(sql);
            //DataSet ds = helper.QueryForDateSet(oArrayList);

            StockCheck oStockCheck = new StockCheck();

            oStockCheck.Source = ds;
            CReportTools tools = new CReportTools();
            DataTable    dt    = ds.Tables[0];
            Decimal      money = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                money += Convert.ToDecimal(dt.Rows[i]["money"]);
            }
            oStockCheck.SumMoney    = tools.ToUpper(money);
            oStockCheck.AccountNum  = id.ToString();
            oStockCheck.ContractNum = "100086";
            oStockCheck.CoName      = "中百科技有限公司";
            oStockCheck.Num         = "1111";
            oStockCheck.InvoiceNo   = "0001";
            oStockCheck.Supplier    = "中百";
            oStockCheck.Telephone   = "138888888";
            oStockCheck.Auditor     = "刘淼";
            oStockCheck.Examine     = "bbb";
            oStockCheck.Approve     = "ccc";
            oStockCheck.AuditorYmd  = "2008年5月21号";
            oStockCheck.ExamineYmd  = "2008年5月22号";
            oStockCheck.ApproveYmd  = "2008年5月23号";
            oStockCheck.ShowReport();
        }
Example #2
0
        public void RunTransportCheck(string id)
        {
            //材料种类	    sort
            //材料名称	    materialName
            //规格		    model
            //起运地		startSite
            //止运地		endSite
            //运输数量	    quantity
            //运输距离	    distance
            //单价		    unitPrice
            //金额(元)	money
            SqlHelper helper = new SqlHelper();
            String    sql    = "select tsmd.id, coalesce(pn.name,mn.name) as materialName,coalesce(pm.model,mm.model) as model,coalesce(pk.sort,mk.sort) as sort ";

            sql += ",site1.site as startSite,site2.site as endSite,distance,price as unitPrice,tsmId,case mark when 1 then '已终止' else '执行中' end mark,tsmd.count as quantity,tsmd.sum as money,tsm.remark as formula";
            sql += " from transportGoodsInformationCorresponding tgi inner join transportSettlementMethod tsm on tsmid=tsm.id";
            sql += " inner join transportSettlementDetail tsmd on tsmd.tgicId=tgi.id ";
            sql += " left join material m on m.id=mid";
            sql += " left join materialName mn on m.mnid=mn.id left join materialModel mm on m.mmid=mm.id ";
            sql += " left join materialKind mk on mn.mkid=mk.id";
            sql += " left join product p on p.id=pid left join productName pn on p.pnid=pn.id ";
            sql += " left join productModel pm on p.pmid=pm.id ";
            sql += " left join productKind pk on pn.pkid=pk.id";
            sql += " left join site site1 on tgi.sid1=site1.id";
            sql += " left join site site2 on tgi.sid1=site2.id";
            sql += " where tsmd.tsid=" + id;
            System.Collections.ArrayList oArrayList = new System.Collections.ArrayList();
            oArrayList.Add(sql);
            DataSet ds = helper.QueryForDateSet(oArrayList);

            TransportCheck oYearStockPlan = new TransportCheck();

            oYearStockPlan.Source = ds;
            CReportTools tools = new CReportTools();
            DataTable    dt    = ds.Tables[0];
            Decimal      money = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                money += Convert.ToDecimal(dt.Rows[i]["money"]);
            }
            oYearStockPlan.SumMoney    = tools.ToUpper(money);
            oYearStockPlan.AccountNum  = "3444";
            oYearStockPlan.ContractNum = "100086";
            oYearStockPlan.CoName      = "中百";
            oYearStockPlan.Num         = "1111";
            oYearStockPlan.InvoiceNo   = "0001";
            oYearStockPlan.Supplier    = "中百";
            oYearStockPlan.Telephone   = "138888888";
            oYearStockPlan.Auditor     = "刘淼";
            oYearStockPlan.Examine     = "bbb";
            oYearStockPlan.Approve     = "ccc";
            oYearStockPlan.AuditorYmd  = "2008年5月21号";
            oYearStockPlan.ExamineYmd  = "2008年5月22号";
            oYearStockPlan.ApproveYmd  = "2008年5月23号";
            oYearStockPlan.ShowReport();
        }