private void toolStripLabelPrint_Click(object sender, EventArgs e) { string ProductionCheckId = dataGridView1.SelectedRows[0].Cells["ProductionCheckId"].Value.ToString(); string ProductionWaitId = dataGridView1.SelectedRows[0].Cells["ProductionWaitId"].Value.ToString(); if (Convert.ToDouble(CountProduct(ProductionWaitId)) < 1) { if (dataGridView1.RowCount <= 0) return; if (dataGridView1.SelectedRows.Count <= 0) return; StringBuilder sql = new StringBuilder(); sql.Append("SELECT pwh.ProductionWaitId,e.EmployerName, s.ShipperName, pwh.ProductionWaitDate, pf.FmName, pc.ProductionCateName, pwd.ProductionWaitPallet, pwd.ProductionWaitDetailQuantity,pf.FmId "); sql.Append("FROM dbo.ProductionWaitDetail AS pwd INNER JOIN " + "dbo.ProductionWaitHead AS pwh ON pwd.ProductionWaitId = pwh.ProductionWaitId INNER JOIN " + "dbo.EMPLOYER AS e ON pwh.EmployerId = e.EmployerId INNER JOIN " + "dbo.SHIPPER AS s ON pwh.ShipperId = s.ShipperId INNER JOIN " + "dbo.ProductionFormular AS pf ON pwd.FmId = pf.FmId INNER JOIN " + "dbo.ProductionCate AS pc ON pf.ProductionCateId = pc.ProductionCateId "); sql.Append("WHERE pwh.ProductionWaitId = '" + ProductionWaitId + "' ");//ดึงรายการสินค้ารอตรวจ DataTable data = Class.DBConnString.clsDB.QueryDataTable(sql.ToString()); data.TableName = "ReceiveNetFromJ"; Report.Production.CtrReceiveNetFromJm r = new Report.Production.CtrReceiveNetFromJm();//เรียกหน้าออกรายงาน r.SetDataSource(data); ProductionNew.RptProductionReq ctr = new RptProductionReq(r);//เรียกหน้าออกรายงาน ctr.StartPosition = FormStartPosition.CenterScreen; ctr.ShowDialog(); } else { if (dataGridView1.RowCount <= 0) return; if (dataGridView1.SelectedRows.Count <= 0) return; StringBuilder sql = new StringBuilder(); sql.Append("select c.ProductionWaitId,e.EmployerName,sh.ShipperName,convert(varchar, DATEADD(YEAR,543,wh.ProductionWaitDate),103) ProductionWaitDate,w.ProductionCheckId,w.ProductId FmId,w.ProductId ProductionCateName,p.ProductName FmName,"); sql.Append("sum(w.Quantity) ProductionWaitDetailQuantity,u.UnitSaleName,pcs.productioncheckstatusname " + "from ProductionCheckWell w inner join product p on w.productid = p.productid " + "inner join unitsale u on p.unitsaleid = u.unitsaleid " + "inner join productioncheckstatus pcs on w.productioncheckstatusid = pcs.productioncheckstatusid " + "inner join ProductionCheck c on c.ProductionCheckId=w.ProductionCheckId " + "inner join ProductionWaitHead wh on wh.ProductionWaitId=c.ProductionWaitId " + "inner join EMPLOYER e on e.EmployerId=wh.EmployerId " + "inner join SHIPPER sh ON sh.ShipperId=wh.ShipperId " + "where w.ProductionCheckId='" + ProductionCheckId + "' " + "group by c.ProductionWaitId,e.EmployerName,sh.ShipperName,wh.ProductionWaitDate,u.UnitSaleName,pcs.productioncheckstatusname," + "w.ProductionCheckId,w.ProductId,p.ProductName "); DataTable data = Class.DBConnString.clsDB.QueryDataTable(sql.ToString()); data.TableName = "ReceiveNetFromJ"; Report.Production.CtrReceiveNetFromProduct r = new Report.Production.CtrReceiveNetFromProduct();//เรียกหน้าออกรายงาน r.SetDataSource(data); ProductionNew.RptProductionReq ctr = new RptProductionReq(r);//เรียกหน้าออกรายงาน ctr.StartPosition = FormStartPosition.CenterScreen; ctr.ShowDialog(); } }
private void รายงานหมายเลข7ToolStripMenuItem_Click(object sender, EventArgs e) { string sqlhead = "select ph.pmwheadid,CONVERT(VARCHAR(10),DATEADD(YEAR,543,ph.pmwheaddate),103) as pmwheaddate,e.employername,a.Accountnoprison,a.Accountnameprison,b.bankbranchname AS bankbranchnameprison \n" + "from ProductionMakingNetsWage_Head ph \n" + "inner join employer e on e.employerid = ph.employerid \n" + "left join AccountPrison a on a.employerid = ph.employerid \n" + "left join BankBranch b on b.bankbranchid = a.bankbranchid \n" + "where ph.pmwheadid = '" + DgvHead.SelectedRows[0].Cells[0].Value.ToString() + "'"; DataTable DtHead = Class.DBConnString.clsDB.QueryDataTable(sqlhead); string sqldetail = "select t.typeplusdelname,pd.fmid,f.fmname,pd.pmwdetailquantityn7,pd.pmwdetailquantityoutside, \n" + "pd.pwn7,pd.pwoutside,pmwdetailsumn7,pmwdetailsumoutside,pmwdetailsumn7+pmwdetailsumoutside AS TotalSum \n" + "from ProductionMakingNetsWage_Detail pd \n" + "inner join ProductionFormular f on pd.fmid = f.fmid \n" + "inner join ProductionMakingNetsWage_TypeNet t on pd.typeplusdel = t.typeplusdel \n" + "where pd.pmwheadid = '" + DgvHead.SelectedRows[0].Cells[0].Value.ToString() + "' and pd.typeplusdel = 1 and pd.pmwdetailquantityn7 <> 0"; DataTable Dt = Class.DBConnString.clsDB.QueryDataTable(sqldetail); System.Data.DataSet ds = new System.Data.DataSet(); DtHead.TableName = "MakingNetsHead"; Dt.TableName = "MakingNetsDetail"; ds.Tables.Add(DtHead); ds.Tables.Add(Dt); Report.Production.CtrMakingNetsReportN7 j = new Report.Production.CtrMakingNetsReportN7(); j.SetDataSource(ds); j.SetParameterValue("Company", "บจก. เคทีซี เน็ตติ้ง"); RptProductionReq CtrV = new RptProductionReq(j); CtrV.StartPosition = FormStartPosition.CenterParent; CtrV.ShowDialog(); }
private void toolStripLabelPrint_Click(object sender, EventArgs e) { if (DgvHead.Rows.Count <= 0) return; if (DgvHead.SelectedRows.Count != 1) return; string TransferMoneyNo = DgvHead.SelectedRows[0].Cells["TransferMoneyNo"].Value.ToString(); string sql = "SELECT * \n" + "FROM ProductionTransferMoneyHead pth \n" + "INNER JOIN ProductionTransferMoneyDetail ptd ON pth.TransferMoneyNo = ptd.TransferMoneyNo \n" + "INNER JOIN EMPLOYER e ON pth.EmployerId = e.EmployerId \n" + "INNER JOIN ProductionPrisonWage ppw ON ptd.PwId = ppw.PwId \n" + "INNER JOIN UserLogin u ON pth.UserName = u.UserName where pth.TransferMoneyNo = '" + TransferMoneyNo + "'"; DataTable data = Class.DBConnString.clsDB.QueryDataTable(sql); data.TableName = "TransferMoneyToJ"; Report.Production.CtrTransferMoneyJ j = new Report.Production.CtrTransferMoneyJ(); j.SetDataSource(data); j.SetParameterValue("Company", Class.DBConnString.sDb); RptProductionReq CtrV = new RptProductionReq(j); CtrV.StartPosition = FormStartPosition.CenterParent; CtrV.ShowDialog(); }
private void รายงานภายนอกToolStripMenuItem_Click(object sender, EventArgs e) { string sqlhead = "select ph.pmwheadid,CONVERT(VARCHAR(10),DATEADD(YEAR,543,ph.pmwheaddate),103) as pmwheaddate,e.employername, \n" + "ph.PmwHeadCountPB,ph.PmwHeadPwPB,ph.PmwHeadPB,ph.PmwHeadCountTranspot,ph.PmwHeadPwTranspot,ph.PmwHeadTranspot,ph.PmwHeadShip, \n" + "ph.PmwHeadSumN7,ph.PmwHeadSumOutSide,ph.PmwHeadSumN7Out,ph.PmwNote,a.Accountnoprison,a.Accountnameprison,o.BookNo,o.BookName,b.bankbranchname,br.bankbranchname AS bankbranchnameprison \n" + "from ProductionMakingNetsWage_Head ph \n" + "inner join employer e on e.employerid = ph.employerid \n" + "left join AccountPrison a on a.employerid = ph.employerid \n" + "left join OWNACCOUNT o on o.BookNo = ph.PmwAccount \n" + "left join BankBranch b on b.bankbranchid = a.bankbranchid \n" + "left join BankBranch br on br.bankbranchid = o.bankbranchid \n" + "where ph.pmwheadid = '" + DgvHead.SelectedRows[0].Cells[0].Value.ToString() + "'"; DataTable DtHead = Class.DBConnString.clsDB.QueryDataTable(sqlhead); string sqldetail = "select t.typeplusdelname,pd.fmid,f.fmname,pd.pmwdetailquantityn7,pd.pmwdetailquantityoutside, \n" + "pd.pwn7,pd.pwoutside,pmwdetailsumn7,pmwdetailsumoutside,pmwdetailsumn7+pmwdetailsumoutside AS TotalSum, \n" + "case when pd.typeplusdel in (2,3) then 'บวก' when pd.typeplusdel in (4,5) then 'หัก' else '' end AS Type \n" + "from ProductionMakingNetsWage_Detail pd \n" + "inner join ProductionFormular f on pd.fmid = f.fmid \n" + "inner join ProductionMakingNetsWage_TypeNet t on pd.typeplusdel = t.typeplusdel \n" + "where pd.pmwheadid = '" + DgvHead.SelectedRows[0].Cells[0].Value.ToString() + "' and t.typeplusdel <> 1"; DataTable Dt = Class.DBConnString.clsDB.QueryDataTable(sqldetail); string sqldetailsub = "select t.typeplusdelname,pd.fmid,f.fmname,pd.pmwdetailquantityn7,pd.pmwdetailquantityoutside, \n" + "pd.pwn7,pd.pwoutside,pmwdetailsumn7,pmwdetailsumoutside,pmwdetailsumn7+pmwdetailsumoutside AS TotalSum, \n" + "case when pd.typeplusdel in (2,3) then 'บวก' when pd.typeplusdel in (4,5) then 'หัก' else '' end AS Type \n" + "from ProductionMakingNetsWage_Detail pd \n" + "left join ProductionFormular f on pd.fmid = f.fmid \n" + "inner join ProductionMakingNetsWage_TypeNet t on pd.typeplusdel = t.typeplusdel \n" + "where pd.pmwheadid = '" + DgvHead.SelectedRows[0].Cells[0].Value.ToString() + "' and t.typeplusdel = 1"; DataTable DtSub = Class.DBConnString.clsDB.QueryDataTable(sqldetailsub); System.Data.DataSet ds = new System.Data.DataSet(); DtHead.TableName = "MakingNetsHead"; Dt.TableName = "MakingNetsDetail"; DtSub.TableName = "MakingNetsDetailSub"; ds.Tables.Add(DtHead); ds.Tables.Add(Dt); ds.Tables.Add(DtSub); Report.Production.CtrMakingNetsReportOutSide j = new Report.Production.CtrMakingNetsReportOutSide(); j.SetDataSource(ds); j.SetParameterValue("Company", Class.DBConnString.sDb); RptProductionReq CtrV = new RptProductionReq(j); CtrV.StartPosition = FormStartPosition.CenterParent; CtrV.ShowDialog(); }
private void บตรแขงToolStripMenuItem_Click(object sender, EventArgs e) { string sql = "select ph.pmwheadid,e.employername,CONVERT(VARCHAR(10),DATEADD(YEAR,543,ph.pmwheaddate),103) as pmwheaddate, \n" + "CONVERT(VARCHAR(10),DATEADD(YEAR,543,pc.pmwcarddate),103) as pmwcarddate,f.fmid,f.fmname,pc.pmwcardquantity,pct.Pmwcardstatusname \n" + "from ProductionMakingNetsWage_Card pc \n" + "inner join ProductionMakingNetsWage_Detail pd on pd.Pmwdetailid = pc.Pmwdetailid \n" + "inner join ProductionMakingNetsWage_Head ph on ph.Pmwheadid = pd.Pmwheadid \n" + "inner join ProductionMakingNetsWage_StatusCard pct on pc.Pmwcardstatus = pct.Pmwcardstatus \n" + "inner join Employer e on e.Employerid = ph.Employerid \n" + "inner join ProductionFormular f on pd.fmid = f.fmid \n" + "where ph.Pmwheadid = '" + DgvHead.SelectedRows[0].Cells[0].Value.ToString() + "'"; DataTable Dt = Class.DBConnString.clsDB.QueryDataTable(sql); System.Data.DataSet ds = new System.Data.DataSet(); Dt.TableName = "MakingNetsCard"; ds.Tables.Add(Dt); Report.Production.CtrMakingNetsReportCard j = new Report.Production.CtrMakingNetsReportCard(); j.SetDataSource(ds); j.SetParameterValue("Company", Class.DBConnString.sDb); RptProductionReq CtrV = new RptProductionReq(j); CtrV.StartPosition = FormStartPosition.CenterParent; CtrV.ShowDialog(); }
private void toolStripButton3_Click(object sender, EventArgs e) { string sqlhead = "SELECT CONVERT(VARCHAR(10),DATEADD(YEAR,543,ph.PrmHeadNetDateOld),103) AS PrmHeadNetDateOld,CONVERT(VARCHAR(10),DATEADD(YEAR,543,ph.PrmHeadNetDate),103) AS PrmHeadNetDate, \n" + "ph.PrmHeadNetNumOld,ph.PrmHeadSumProduction,ph.PrmHeadNetNum,ph.PrmHeadNetSumTotal,ph.PrmHeadNetFailOldPrison,ph.PrmHeadNetFailOldCompany,ph.PrmHeadNetFailPrison, \n" + "ph.PrmHeadNetFailCompany,ph.PrmHeadCatePrison,ph.PrmHeadCateCompany,ph.PrmHeadSumFailPrison,ph.PrmHeadSumFailCompany,ph.PrmHeadSumReceive, \n" + "CONVERT(VARCHAR(10),DATEADD(YEAR,543,ph.TransferMoneyDate),103) AS TransferMoneyDate,ph.TransferMoneyNo,ph.TransferCount,ph.PrmHeadid, \n" + "CONVERT(VARCHAR(10),DATEADD(YEAR,543,ph.PrmHeadNetDate),103) AS PrmHeadDate,e.EmployerName \n" + "FROM ProductionReportMonth_Head ph INNER JOIN Employer e ON ph.Employerid = e.Employerid WHERE PrmHeadId = '" + DgvHead.SelectedRows[0].Cells[0].Value.ToString() + "'"; DataTable DtHead = Class.DBConnString.clsDB.QueryDataTable(sqlhead); string sqldetail = "SELECT CONVERT(VARCHAR(10),DATEADD(YEAR,543,pd.ProductionWaitDate),103) AS ProductionWaitDate, \n" + "pd.ProductionWaitId,pd.FmName,pd.ProductionWaitHand,c.ProductionCateName,pdnc.PCateName,pd.Quantity,pd.NetWell,pd.NetFailPrison,pd.NetFailCompany, \n" + "CAST(CAST(((pd.NetFailPrison + pd.NetFailCompany) * 100) AS DECIMAL(10,2)) / CAST(pd.NetNum AS DECIMAL(10,2)) AS DECIMAL(10,2)) AS [Percent], \n" + "pd.NetNum,pd.NetLost,pd.PrmDetailTotalPay,pd.PrmDetailTotalUnPay \n" + "FROM ProductionReportMonth_Detail pd \n" + "INNER JOIN Productioncate c ON c.ProductionCateId = pd.ProductionCateId \n" + "INNER JOIN productionnetcate pdnc ON pdnc.PCateId = pd.PCateId \n" + "WHERE pd.PrmHeadId = '" + DgvHead.SelectedRows[0].Cells[0].Value.ToString() + "'"; DataTable Dt = Class.DBConnString.clsDB.QueryDataTable(sqldetail); System.Data.DataSet ds = new System.Data.DataSet(); DtHead.TableName = "ReportMonthHead"; Dt.TableName = "ReportMonthDetail"; ds.Tables.Add(DtHead); ds.Tables.Add(Dt); Report.Production.CtrProductionReportMonth j = new Report.Production.CtrProductionReportMonth(); j.SetDataSource(ds); j.SetParameterValue("Company", Class.DBConnString.sDb); RptProductionReq CtrV = new RptProductionReq(j); CtrV.StartPosition = FormStartPosition.CenterParent; CtrV.ShowDialog(); }
/*ดึงข้อมูลออกรายงานในส่งซ่อม*/ private void toolStripLabelPrint_Click(object sender, EventArgs e) { if (dataGridView1.Rows.Count <= 0) return; if (dataGridView1.SelectedRows.Count <= 0) return; string ProductionRepairHeadId = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();//เก็บเลขที่ใบซ่อม StringBuilder sql = new StringBuilder(); sql.Append("SELECT prh.ProductionRepairHeadDate, e.EmployerName, pcate.ProductionCateName, pf.FmName, pnf.NetFName, prd.Quantity, pc.ProductionWaitId, pf.FmId, prh.ProductionRepairHeadId, pwh.ProductionWaitDate "); sql.Append("FROM dbo.ProductionRepairDetail AS prd INNER JOIN " + "dbo.ProductionRepairHead AS prh ON prd.ProductionRepairHeadId = prh.ProductionRepairHeadId INNER JOIN " + "dbo.ProductionCheckFail AS pcf ON prd.ProductionCheckFailId = pcf.ProductionCheckFailId INNER JOIN " + "dbo.ProductionNettingFail AS pnf ON pcf.NetFId = pnf.NetFId INNER JOIN " + "dbo.ProductionCheck AS pc ON pcf.ProductionCheckId = pc.ProductionCheckId INNER JOIN " + "dbo.ProductionFormular AS pf ON prd.FmId = pf.FmId INNER JOIN " + "dbo.ProductionCate AS pcate ON pf.ProductionCateId = pcate.ProductionCateId INNER JOIN " + "dbo.EMPLOYER AS e ON prh.EmployerId = e.EmployerId INNER JOIN " + "dbo.ProductionWaitHead AS pwh ON pc.ProductionWaitId = pwh.ProductionWaitId "); sql.Append("WHERE prh.ProductionRepairHeadId = '" + ProductionRepairHeadId + "' "); DataTable data = Class.DBConnString.clsDB.QueryDataTable(sql.ToString()); data.TableName = "SendNetFailur"; Report.Production.CtrSendNetRepair r = new Report.Production.CtrSendNetRepair(); r.SetDataSource(data); ProductionNew.RptProductionReq ctr = new RptProductionReq(r); ctr.StartPosition = FormStartPosition.CenterScreen; ctr.ShowDialog(); }
private void showReport(string strTranfNo) { string sql = "SELECT * \n" + "FROM ProductionTransferMoneyHead pth \n" + "INNER JOIN ProductionTransferMoneyDetail ptd ON pth.TransferMoneyNo = ptd.TransferMoneyNo \n" + "INNER JOIN EMPLOYER e ON pth.EmployerId = e.EmployerId \n" + "INNER JOIN ProductionPrisonWage ppw ON ptd.PwId = ppw.PwId \n" + "INNER JOIN UserLogin u ON pth.UserName = u.UserName where pth.TransferMoneyNo = '" + strTranfNo + "'"; DataTable data = Class.DBConnString.clsDB.QueryDataTable(sql); data.TableName = "TransferMoneyToJ"; Report.Production.CtrTransferMoneyJ j = new Report.Production.CtrTransferMoneyJ(); j.SetDataSource(data); j.SetParameterValue("Company", DBConnString.sDb); RptProductionReq CtrV = new RptProductionReq(j); CtrV.StartPosition = FormStartPosition.CenterParent; CtrV.ShowDialog(); }