private void btnPrint_Click(object sender, EventArgs e) { Reports.reportDataSet rds = new Reports.reportDataSet(); DataRow newRow = rds.Tables["Kalkulacija"].NewRow(); newRow["NazivSmese"] = _smesaNaziv; newRow["UkupnoKabaste"] = lblTotalKabaste1.Text; newRow["UkupnoKupovne"] = lblTotalKupovne1.Text; newRow["UkupnoAmk"] = lblTotalAmk1.Text; newRow["Ukupno"] = lblTotal1.Text; newRow["NazivKalkulacije"] = _kalkulacijaNaziv; rds.Tables["Kalkulacija"].Rows.Add(newRow); foreach (DataRow row in _sirovinaCenaDT[0].Rows) { newRow = rds.Tables["KalkulacijaSirovina"].NewRow(); newRow["naziv"] = row["Naziv"]; newRow["kolicina"] = row["KolicinaKorigovano"].ToString() != string.Empty ? row["KolicinaKorigovano"] : row["Kolicina"]; newRow["cena"] = row["Cena"]; newRow["ukupno"] = row["Ukupno"]; newRow["jmNaziv"] = row["Jm"]; newRow["tipSirovineCode"] = int.Parse(row["TipSirovineID"].ToString()) == 1 ? "Kabaste" : "Kupovne"; newRow["udeo"] = decimal.Parse(row["Ukupno"].ToString()) / decimal.Parse(lblTotal1.Text) * 100; rds.Tables["KalkulacijaSirovina"].Rows.Add(newRow); } CrystalDecisions.CrystalReports.Engine.ReportDocument rd = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rd.Load("Reports/KalkulacijaTroskovi.rpt"); rd.SetDataSource(rds); frmPrint objfrmPrint = new frmPrint(); objfrmPrint.crystalReportViewer1.ReportSource = rd; objfrmPrint.Show(); }
protected void PotrosnjaKalkulacije_KalkulacijeSelected(string ids) { DataTable potrosnja = _kalkulacijaBL.GetPotrosnja(ids); Reports.reportDataSet rds = new Reports.reportDataSet(); DataRow newRow; foreach (DataRow row in potrosnja.Rows) { newRow = rds.Tables["KalkulacijePotrosnja"].NewRow(); newRow["KalkulacijaID"] = row["kalkulacija_id"]; newRow["KalkulacijaNaziv"] = row["kalkulacija_naziv"]; newRow["SmesaNaziv"] = row["smesa_naziv"]; newRow["Dnevno"] = row["dnevno"]; newRow["Mesecno"] = row["mesecno"]; newRow["Godisnje"] = row["godisnje"]; rds.Tables["KalkulacijePotrosnja"].Rows.Add(newRow); } CrystalDecisions.CrystalReports.Engine.ReportDocument rd = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rd.Load("Reports/KalkulacijePotrosnja.rpt"); rd.SetDataSource(rds); frmPrint objfrmPrint = new frmPrint(); objfrmPrint.crystalReportViewer1.ReportSource = rd; objfrmPrint.Show(); }
protected void Kalkulacije_KalkulacijeSelected(string ids) { DataTable potrosnja = _sirovinaBL.GetPotrosnjaUPeriodu(ids); Reports.reportDataSet rds = new Reports.reportDataSet(); DataRow newRow = rds.Tables["PotrosnjaKabastihSirovinaUPeriodu"].NewRow(); foreach (DataRow row in potrosnja.Rows) { newRow = rds.Tables["PotrosnjaKabastihSirovinaUPeriodu"].NewRow(); newRow["NazivKalkulacije"] = row["kalkulacija_naziv"]; newRow["NazivSirovine"] = row["sirovina_naziv"]; newRow["Kolicina"] = row["kolicina"]; newRow["MesecnaPotrosnja"] = row["mesecno"]; newRow["GodisnjaPotrosnja"] = row["godisnje"]; rds.Tables["PotrosnjaKabastihSirovinaUPeriodu"].Rows.Add(newRow); } CrystalDecisions.CrystalReports.Engine.ReportDocument rd = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); if (_reportID == 1) { rd.Load("Reports/PotrosnjaKabastihSirovinaUPeriodu.rpt"); } else if (_reportID == 2) { rd.Load("Reports/PotrosnjaKabastihSirovina.rpt"); } rd.SetDataSource(rds); frmPrint objfrmPrint = new frmPrint(); objfrmPrint.crystalReportViewer1.ReportSource = rd; objfrmPrint.Show(); }
protected void TroskoviKalkulacije_KalkulacijeSelected(string ids) { DataTable troskovi = _kalkulacijaBL.GetTroskovi(ids); Reports.reportDataSet rds = new Reports.reportDataSet(); DataRow newRow; foreach (DataRow row in troskovi.Rows) { newRow = rds.Tables["KalkulacijeTroskovi"].NewRow(); newRow["KalkulacijaID"] = row["kalkulacija_id"]; newRow["KalkulacijaNaziv"] = row["kalkulacija_naziv"]; newRow["SmesaNaziv"] = row["smesa_naziv"]; newRow["SirovinaNaziv"] = row["sirovina_naziv"]; newRow["Kolicina"] = row["kolicina"]; newRow["JmID"] = row["jm_id"]; newRow["JmNaziv"] = row["jm_naziv"]; newRow["SirovinaCena"] = row["sirovina_cena"]; newRow["Ukupno"] = row["ukupno"]; rds.Tables["KalkulacijeTroskovi"].Rows.Add(newRow); } CrystalDecisions.CrystalReports.Engine.ReportDocument rd = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rd.Load("Reports/KalkulacijeTroskovi.rpt"); rd.SetDataSource(rds); frmPrint objfrmPrint = new frmPrint(); objfrmPrint.crystalReportViewer1.ReportSource = rd; objfrmPrint.Show(); }
private void btnPrintConsumptionReport_Click(object sender, EventArgs e) { Reports.reportDataSet rds = new Reports.reportDataSet(); DataRow newRowKalkulacijaPotrosnja = rds.Tables["KalkulacijaPotrosnja"].NewRow(); newRowKalkulacijaPotrosnja["CenaSmese"] = decimal.Parse(lblTotal1.Text); newRowKalkulacijaPotrosnja["KalkulacijaNaziv"] = _kalkulacijaNaziv; newRowKalkulacijaPotrosnja["SmesaNaziv"] = _smesaNaziv; rds.Tables["KalkulacijaPotrosnja"].Rows.Add(newRowKalkulacijaPotrosnja); foreach (DataGridViewRow row in dgvTroskovi.Rows) { DataRow newRow = rds.Tables["KalkulacijaPotrosnjaStavka"].NewRow(); newRow["KategorijaZivotinja"] = row.Cells["KategorijaZivotinjaNaziv"].Value; newRow["BrojZivotinja"] = row.Cells["BrojZivotinja"].Value; newRow["DnevnaPotrosnjaPoZivotinji"] = row.Cells["DnevnaPotrosnjaPoZivotinji"].Value; newRow["DnevnaPotrosnjaKolicina"] = row.Cells["DnevnaPotrosnja"].Value; newRow["DnevnaPotrosnjaIznos"] = decimal.Parse(row.Cells["DnevnaPotrosnja"].Value.ToString()) * decimal.Parse(lblTotal1.Text) / (decimal)100; newRow["NedeljnaPotrosnjaKolicina"] = row.Cells["NedeljnaPotrosnja"].Value; newRow["NedeljnaPotrosnjaIznos"] = decimal.Parse(row.Cells["NedeljnaPotrosnja"].Value.ToString()) * decimal.Parse(lblTotal1.Text) / (decimal)100; //newRow["MesecnaPotrosnjaKolicina"] = decimal.Parse(row.Cells["NedeljnaPotrosnja"].Value.ToString()) * (decimal)4.5; newRow["MesecnaPotrosnjaKolicina"] = decimal.Parse(row.Cells["DnevnaPotrosnja"].Value.ToString()) * 31; //newRow["MesecnaPotrosnjaIznos"] = decimal.Parse(row.Cells["NedeljnaPotrosnja"].Value.ToString()) * (decimal)4.5 * decimal.Parse(lblTotal1.Text) / (decimal)100; newRow["MesecnaPotrosnjaIznos"] = decimal.Parse(row.Cells["DnevnaPotrosnja"].Value.ToString()) * 31 * decimal.Parse(lblTotal1.Text) / (decimal)100; //newRow["GodisnjaPotrosnjaKolicina"] = decimal.Parse(newRow["MesecnaPotrosnjaKolicina"].ToString()) * (decimal)12; newRow["GodisnjaPotrosnjaKolicina"] = decimal.Parse(row.Cells["DnevnaPotrosnja"].Value.ToString()) * 365; //newRow["GodisnjaPotrosnjaIznos"] = decimal.Parse(newRow["MesecnaPotrosnjaKolicina"].ToString()) * (decimal)12 * decimal.Parse(lblTotal1.Text) / (decimal)100; newRow["GodisnjaPotrosnjaIznos"] = decimal.Parse(row.Cells["DnevnaPotrosnja"].Value.ToString()) * 365 * decimal.Parse(lblTotal1.Text) / (decimal)100; rds.Tables["KalkulacijaPotrosnjaStavka"].Rows.Add(newRow); } CrystalDecisions.CrystalReports.Engine.ReportDocument rd = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rd.Load("Reports/KalkulacijaPotrosnja.rpt"); rd.SetDataSource(rds); frmPrint objfrmPrint = new frmPrint(); objfrmPrint.crystalReportViewer1.ReportSource = rd; objfrmPrint.Show(); }