public void print(DataSet ds) { int len = 79; string header = this.header(ds); RptControl.RptTextCntrl objRptTextCntr = new RptControl.RptTextCntrl(); objRptTextCntr.GF_DrawLine(len); objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("Purchaser Name", RptControl.TextAlign.Center, 15, true); objRptTextCntr.Gf_DrawText("Invoice Slno", RptControl.TextAlign.Center, 12, true); objRptTextCntr.Gf_DrawText("Date", RptControl.TextAlign.Center, 13, true); objRptTextCntr.Gf_DrawText("Gold", RptControl.TextAlign.Center, 14, true); objRptTextCntr.Gf_DrawText("Weight", RptControl.TextAlign.Center, 10, true); objRptTextCntr.Gf_DrawText("Rate", RptControl.TextAlign.Center, 10, true); objRptTextCntr.GF_AddNewLine(0); objRptTextCntr.GF_DrawLine(len); int i = 0; while (i < ds.Tables[0].Rows.Count) { objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText(ds.Tables[0].Rows[i]["addr_nam"], RptControl.TextAlign.Left, 15, true); objRptTextCntr.Gf_DrawText(ds.Tables[0].Rows[i]["invs_slno"], RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText(ds.Tables[0].Rows[i]["date"], RptControl.TextAlign.Left, 13, true); objRptTextCntr.Gf_DrawText(ds.Tables[0].Rows[i]["itm_name"], RptControl.TextAlign.Left, 14, true); objRptTextCntr.Gf_DrawText(ds.Tables[0].Rows[i]["wt"], RptControl.TextAlign.Left, 10, true); objRptTextCntr.Gf_DrawText(ds.Tables[0].Rows[i]["rate"], RptControl.TextAlign.Left, 10, true); objRptTextCntr.GF_AddNewLine(0); i++; } int n = 0; while (n < 5) { objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 15, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 13, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 14, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 10, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 10, true); objRptTextCntr.GF_AddNewLine(0); n++; } objRptTextCntr.GF_DrawLine(len); report_viewer objrpt = new report_viewer(); string print = header; print += objRptTextCntr.GF_GetPrintString(); objrpt.Print = print; objrpt.ShowDialog(); }
public string header() { int len = 79; RptControl.RptTextCntrl objRptTextCntr = new RptControl.RptTextCntrl(); objRptTextCntr.Gf_DrawText("ISSUE TO SMITH", RptControl.TextAlign.Center, len, false); objRptTextCntr.GF_AddNewLine(0); return(objRptTextCntr.GF_GetPrintString()); }
public string header(DataSet ds) { int len = 79; RptControl.RptTextCntrl objRptTextCntr = new RptControl.RptTextCntrl(); objRptTextCntr.Gf_DrawText("Roys Gold", RptControl.TextAlign.Center, len, false); objRptTextCntr.GF_AddNewLine(0); return(objRptTextCntr.GF_GetPrintString()); }
private String LoadRpt(DataTable master, String heading) { try { RptControl.RptTextCntrl objRptTextCntr = new RptControl.RptTextCntrl(); int len = 88; if (!master.Columns.Contains("mcamt")) { len = 75; } double gTtlSal = 0.000; double gTtlRet = 0.000; double gTtlMc = 0.000; double gTtlMcAmt = 0.000; // DataSet ds = this.GetDataSet("LR", PLABS.Utils.CnvToStr(this.ddl_addr.ControlValue)); //DataTable master = PLABS.Utils.GetDataTable(ds, 0); DataTable dtDate = master.DefaultView.ToTable(true, new string[] { "date" }); dtDate.DefaultView.Sort = "date ASC"; dtDate = dtDate.DefaultView.ToTable(); //DataTable name = (DataTable)ddl_addr.DataSource; //DataTable Item = ds.Tables[1]; //DataTable Group = ds.Tables[2]; objRptTextCntr.GF_AddNewLine(1); objRptTextCntr.Gf_DrawText(heading, RptControl.TextAlign.Center, len, false); objRptTextCntr.GF_AddNewLine(1); foreach (DataRow dtDr in dtDate.Rows) { double bal = 0.000; double ttlSal = 0.00; double ttlRet = 0.000; objRptTextCntr.Gf_DrawText(string.Format("DATE:-{0}", PLABS.Utils.CnvToDate(dtDr["date"]).ToString("dd/MMM/yyyy")), RptControl.TextAlign.Left, len, false); objRptTextCntr.GF_AddNewLine(0); objRptTextCntr.GF_DrawLine(len); objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("SHOP", RptControl.TextAlign.Center, 13, true); objRptTextCntr.Gf_DrawText("ITEM", RptControl.TextAlign.Center, 12, true); objRptTextCntr.Gf_DrawText("NET WT", RptControl.TextAlign.Center, 13, true); objRptTextCntr.Gf_DrawText("SALES", RptControl.TextAlign.Center, 12, true); objRptTextCntr.Gf_DrawText("RETURN", RptControl.TextAlign.Center, 12, true); objRptTextCntr.Gf_DrawText("MC WT", RptControl.TextAlign.Center, 8, true); if (master.Columns.Contains("mcamt")) { objRptTextCntr.Gf_DrawText("MC AMT", RptControl.TextAlign.Center, 12, true); } //objRptTextCntr.Gf_DrawText("BALANCE", RptControl.TextAlign.Center, 12, true); objRptTextCntr.GF_AddNewLine(0); objRptTextCntr.GF_DrawLine(len); master.DefaultView.RowFilter = string.Format("date='{0}'", dtDr["date"]); Double mcw = 0; Double mcamt = 0; foreach (DataRow masterDr in master.DefaultView.ToTable().Rows) { objRptTextCntr.Gf_AddSeperator(); mcw += PLABS.Utils.CnvToDouble(masterDr["mc"]); if (master.Columns.Contains("mcamt")) { mcamt += PLABS.Utils.CnvToDouble(masterDr["mcamt"]); } objRptTextCntr.Gf_DrawText(masterDr["name"], RptControl.TextAlign.Left, 13, true); objRptTextCntr.Gf_DrawText(masterDr["itm"], RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText(masterDr["nw"], RptControl.TextAlign.Right, 13, true); if (PLABS.Utils.CnvToDouble(masterDr["pw"]) > 0) { objRptTextCntr.Gf_DrawText(masterDr["pw"], RptControl.TextAlign.Right, 12, true, "F3"); ttlSal += PLABS.Utils.CnvToDouble(masterDr["pw"]); gTtlSal += PLABS.Utils.CnvToDouble(masterDr["pw"]); } else { objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Center, 12, true); } if (PLABS.Utils.CnvToDouble(masterDr["pw"]) < 0) { objRptTextCntr.Gf_DrawText(Math.Abs(PLABS.Utils.CnvToDouble(masterDr["pw"])), RptControl.TextAlign.Right, 12, true, "F3"); ttlRet += Math.Abs(PLABS.Utils.CnvToDouble(masterDr["pw"])); gTtlRet += Math.Abs(PLABS.Utils.CnvToDouble(masterDr["pw"])); } else { objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Center, 12, true); } if (PLABS.Utils.CnvToDouble(masterDr["mc"]) > 0) { objRptTextCntr.Gf_DrawText(masterDr["mc"], RptControl.TextAlign.Right, 8, true, "F3"); } else { objRptTextCntr.Gf_DrawText(masterDr["mc"], RptControl.TextAlign.Right, 8, true, "F3"); } if (master.Columns.Contains("mcamt")) { if (PLABS.Utils.CnvToDouble(masterDr["mcamt"]) > 0) { objRptTextCntr.Gf_DrawText(masterDr["mcamt"], RptControl.TextAlign.Right, 12, true, "F3"); } else { objRptTextCntr.Gf_DrawText(masterDr["mcamt"], RptControl.TextAlign.Right, 12, true, "F3"); } } gTtlMc += PLABS.Utils.CnvToDouble(masterDr["mc"]); if (master.Columns.Contains("mcamt")) { gTtlMcAmt += PLABS.Utils.CnvToDouble(masterDr["mcamt"]); } bal += PLABS.Utils.CnvToDouble(masterDr["pw"]); //objRptTextCntr.Gf_DrawText(bal, RptControl.TextAlign.Center, 12, true,"F3"); objRptTextCntr.GF_AddNewLine(0); //objRptTextCntr.GF_DrawLine(len); } objRptTextCntr.GF_DrawLine(len); objRptTextCntr.Gf_AddSeperator(); //objRptTextCntr.Gf_DrawText("SHOP", RptControl.TextAlign.Center, 13, true); //objRptTextCntr.Gf_DrawText("ITEM", RptControl.TextAlign.Center, 12, true); objRptTextCntr.Gf_DrawText("TOTAL", RptControl.TextAlign.Right, 40, true); objRptTextCntr.Gf_DrawText(ttlSal, RptControl.TextAlign.Right, 12, true, "F3"); objRptTextCntr.Gf_DrawText(ttlRet, RptControl.TextAlign.Right, 12, true, "F3"); objRptTextCntr.Gf_DrawText(mcw, RptControl.TextAlign.Right, 8, true, "F3"); objRptTextCntr.Gf_DrawText(mcamt, RptControl.TextAlign.Right, 12, true, "F3"); //objRptTextCntr.Gf_DrawText("BALANCE", RptControl.TextAlign.Center, 12, true); objRptTextCntr.GF_AddNewLine(0); objRptTextCntr.GF_DrawLine(len); objRptTextCntr.GF_AddNewLine(2); } objRptTextCntr.GF_DrawLine(len); objRptTextCntr.Gf_AddSeperator(); Double temp = 0.000; temp = gTtlSal - gTtlRet; objRptTextCntr.Gf_DrawText("TOTAL", RptControl.TextAlign.Right, 40, true); objRptTextCntr.Gf_DrawText(temp, RptControl.TextAlign.Right, 12, true, "F3"); objRptTextCntr.Gf_DrawText(gTtlRet, RptControl.TextAlign.Right, 12, true, "F3"); objRptTextCntr.Gf_DrawText(gTtlMc, RptControl.TextAlign.Right, 8, true, "F3"); if (master.Columns.Contains("mcamt")) { objRptTextCntr.Gf_DrawText(gTtlMcAmt, RptControl.TextAlign.Right, 12, true, "F3"); } //objRptTextCntr.Gf_DrawText("BALANCE", RptControl.TextAlign.Center, 12, true); objRptTextCntr.GF_AddNewLine(8); return(objRptTextCntr.GF_GetPrintString()); } catch (Exception ex) { //throw (ex); } return(""); }
public void print(DataTable rpt) { int len = 88; double ttl_prty_wt = 0; double ttlGain = 0.00; string header = this.header(); RptControl.RptTextCntrl objRptTextCntr = new RptControl.RptTextCntrl(); objRptTextCntr.GF_DrawLine(len); objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("Date", RptControl.TextAlign.Center, 13, true); objRptTextCntr.Gf_DrawText("Smith Name", RptControl.TextAlign.Center, 10, true); objRptTextCntr.Gf_DrawText("Gold Issue", RptControl.TextAlign.Center, 10, true); objRptTextCntr.Gf_DrawText("Purity", RptControl.TextAlign.Center, 10, true); objRptTextCntr.Gf_DrawText("Gold Issue WT", RptControl.TextAlign.Center, 10, true); objRptTextCntr.Gf_DrawText("Pure WT", RptControl.TextAlign.Center, 8, true); objRptTextCntr.Gf_DrawText("Description", RptControl.TextAlign.Center, 12, true); objRptTextCntr.Gf_DrawText("Gain", RptControl.TextAlign.Center, 8, true); objRptTextCntr.GF_AddNewLine(0); objRptTextCntr.GF_DrawLine(len); int i = 0; while (i < rpt.Rows.Count) { double purty; purty = Convert.ToDouble(rpt.Rows[i]["purty"]); double gld_wt; gld_wt = Convert.ToDouble(rpt.Rows[i]["grs_wgt"]); double pur_wt = 0; pur_wt = (purty * gld_wt) / 100; string dat = PLABS.Utils.CnvToDate(rpt.Rows[i]["date"]).ToString("dd-MMM-yyyy"); objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText(dat, RptControl.TextAlign.Left, 13, true); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["smith"], RptControl.TextAlign.Left, 10, true); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["gold"], RptControl.TextAlign.Left, 10, true); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["purty"], RptControl.TextAlign.Right, 10, true, "F2"); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["grs_wgt"], RptControl.TextAlign.Right, 10, true, "F3"); objRptTextCntr.Gf_DrawText(pur_wt, RptControl.TextAlign.Right, 8, true, "F3"); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["descr"], RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["Gain"], RptControl.TextAlign.Right, 8, true); ttlGain += PLABS.Utils.CnvToDouble(rpt.Rows[i]["Gain"]); objRptTextCntr.GF_AddNewLine(0); // ttl_gld_wt += Convert.ToDouble(ds.Tables[0].Rows[i]["grs_wgt"]); ttl_prty_wt += Convert.ToDouble(pur_wt); i++; } int n = 0; while (n < 5) { objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 13, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 10, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 10, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 10, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 10, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 8, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 8, true); objRptTextCntr.GF_AddNewLine(0); n++; } objRptTextCntr.GF_DrawLine(len); objRptTextCntr.Gf_AddSeperator(); //objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Right, 28, true); //objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 10, true); //objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 10, true); objRptTextCntr.Gf_DrawText("TOTAL", RptControl.TextAlign.Right, 57, true); objRptTextCntr.Gf_DrawText(ttl_prty_wt, RptControl.TextAlign.Right, 8, true, "F3"); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Right, 12, true); objRptTextCntr.Gf_DrawText(ttlGain, RptControl.TextAlign.Right, 8, true); objRptTextCntr.GF_AddNewLine(0); objRptTextCntr.GF_DrawLine(len); string print = header; print += objRptTextCntr.GF_GetPrintString(); this.rtxt_smthiss_rpt.Text = print; }
private void LoadReport() { try { rtxt_rpt.Text = ""; DataSet ds = this.GetDataSet("LG", this.txt_pgno.Text); DataTable dt = PLABS.Utils.GetDataTable(ds, 0); DataTable dt1 = PLABS.Utils.GetDataTable(ds, 1); if (dt.Rows.Count > 1) { if (_mode == "FRESH") { this.txt_pgno.Text = PLABS.Utils.CnvToStr(dt1.Rows[0]["pgno"]); } int len = 45; double ttlWt = 0.000; double ttlcsh = 0.00; string no = txt_pgno.ControlValue; RptControl.RptTextCntrl objRptTextCntr = new RptControl.RptTextCntrl(); objRptTextCntr.Gf_DrawText(Environment.NewLine, RptControl.TextAlign.Center, 0, false); objRptTextCntr.Gf_DrawText(Environment.NewLine, RptControl.TextAlign.Center, 0, false); objRptTextCntr.Gf_DrawText(this.fnd_smth.SelectedCode, RptControl.TextAlign.Center, 45, false); objRptTextCntr.Gf_DrawText(Environment.NewLine, RptControl.TextAlign.Center, 0, false); objRptTextCntr.Gf_DrawText(Environment.NewLine, RptControl.TextAlign.Center, 0, false); objRptTextCntr.Gf_DrawText(string.Format("{0}", DateTime.Now.ToString("dd-MMM-yy")), RptControl.TextAlign.Center, 16, false); objRptTextCntr.Gf_DrawText(_mode, RptControl.TextAlign.Center, 15, false); objRptTextCntr.Gf_DrawText("No:" + no, RptControl.TextAlign.Center, 8, false); objRptTextCntr.Gf_DrawText(Environment.NewLine, RptControl.TextAlign.Center, 0, false); objRptTextCntr.Gf_DrawText("___________________________________________", RptControl.TextAlign.Center, len, false); objRptTextCntr.Gf_DrawText(Environment.NewLine, RptControl.TextAlign.Center, 0, false); objRptTextCntr.Gf_DrawText("Date", RptControl.TextAlign.Center, 6, true); objRptTextCntr.Gf_DrawText("Itm", RptControl.TextAlign.Center, 3, true); objRptTextCntr.Gf_DrawText("net", RptControl.TextAlign.Center, 8, true); objRptTextCntr.Gf_DrawText("Narration", RptControl.TextAlign.Center, 11, true); //objRptTextCntr.Gf_DrawText("Pur", RptControl.TextAlign.Center, 5, true); objRptTextCntr.Gf_DrawText("Weight", RptControl.TextAlign.Center, 8, true); objRptTextCntr.Gf_DrawText("Cash", RptControl.TextAlign.Center, 8, false); objRptTextCntr.Gf_DrawText(Environment.NewLine, RptControl.TextAlign.Center, 0, false); objRptTextCntr.Gf_DrawText("___________________________________________", RptControl.TextAlign.Center, len, false); objRptTextCntr.Gf_DrawText(Environment.NewLine, RptControl.TextAlign.Center, 0, false); for (int i = 0; i < dt.Rows.Count; i++) { string[] rsltDesc = new string[1]; string desc = PLABS.Utils.CnvToStr(dt.Rows[i]["dsc"]); if (desc.Length > 10) { int cnt = desc.Length / 10; rsltDesc = new string[cnt]; for (int j = 0; cnt > j; j++) { if ((10 * j) + 10 < desc.Length) { rsltDesc[j] = desc.Substring(10 * j, 10); } else { rsltDesc[j] = desc.Substring(10 * j, ((10 * j) + 10) - desc.Length); } } } else { rsltDesc[0] = desc; } for (int strcnt = 0; rsltDesc.Length > strcnt; strcnt++) { if (strcnt == 0) { objRptTextCntr.Gf_DrawText(PLABS.Utils.CnvToDate(dt.Rows[i]["date"]).ToString("dd-MM"), RptControl.TextAlign.Center, 6, false); objRptTextCntr.Gf_DrawText(dt.Rows[i]["Itm"], RptControl.TextAlign.Right, 3, false); objRptTextCntr.Gf_DrawText(dt.Rows[i]["net"], RptControl.TextAlign.Right, 8, false, "F2"); objRptTextCntr.Gf_DrawText(rsltDesc[strcnt] /*dt.Rows[i]["dsc"]*/, RptControl.TextAlign.Center, 11, false); //objRptTextCntr.Gf_DrawText(dt.Rows[i]["prty"], RptControl.TextAlign.Left,5, false); if (PLABS.Utils.CnvToDouble(dt.Rows[i]["wt"]) != 0) { objRptTextCntr.Gf_DrawText(dt.Rows[i]["wt"], RptControl.TextAlign.Right, 8, false, "F2"); } else { objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Center, 8, false); } if (PLABS.Utils.CnvToDouble(dt.Rows[i]["amt"]) != 0) { objRptTextCntr.Gf_DrawText(dt.Rows[i]["amt"], RptControl.TextAlign.Right, 10, false, "N0"); } else { objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Center, 10, false); } objRptTextCntr.Gf_DrawText(Environment.NewLine, RptControl.TextAlign.Center, 0, false); ttlWt += PLABS.Utils.CnvToDouble(dt.Rows[i]["wt"]); ttlcsh += PLABS.Utils.CnvToDouble(dt.Rows[i]["amt"]); } else { objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Center, 10, false); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Center, 6, false); objRptTextCntr.Gf_DrawText(rsltDesc[strcnt] /*dt.Rows[i]["dsc"]*/, RptControl.TextAlign.Left, 11, false); //objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 5, false); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Center, 7, false); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Center, 8, false); objRptTextCntr.Gf_DrawText(Environment.NewLine, RptControl.TextAlign.Center, 0, false); } } } objRptTextCntr.Gf_DrawText("___________________________________________", RptControl.TextAlign.Center, len, false); objRptTextCntr.Gf_DrawText(Environment.NewLine, RptControl.TextAlign.Center, 0, false); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Center, 10, false); objRptTextCntr.Gf_DrawText("TOTAL", RptControl.TextAlign.Left, 11, false); objRptTextCntr.Gf_DrawText(ttlWt, RptControl.TextAlign.Center, 11, false, "F3"); objRptTextCntr.Gf_DrawText(ttlcsh, RptControl.TextAlign.Center, 13, false, "N2"); objRptTextCntr.Gf_DrawText(Environment.NewLine, RptControl.TextAlign.Center, 0, false); objRptTextCntr.Gf_DrawText("___________________________________________", RptControl.TextAlign.Center, len, false); objRptTextCntr.Gf_DrawText(Environment.NewLine, RptControl.TextAlign.Center, 0, false); objRptTextCntr.Gf_DrawText(Environment.NewLine, RptControl.TextAlign.Center, 0, false); objRptTextCntr.Gf_DrawText(Environment.NewLine, RptControl.TextAlign.Center, 0, false); objRptTextCntr.Gf_DrawText("m", RptControl.TextAlign.Left, 10, false); this.rtxt_rpt.Text = objRptTextCntr.GF_GetPrintString(); } else { PLABS.MessageBoxPL.Show("No Data Found"); } } catch (Exception ex) { PLABS.MessageBoxPL.Show(ex.Message); } }
public void print() { int len = 90; RptControl.RptTextCntrl objRptTextCntr = new RptControl.RptTextCntrl(); objRptTextCntr.GF_AddNewLine(1); string Report = string.Empty; if (_rptType == "4") { Report = "SALES"; } if (_rptType == "3") { Report = "PURCHASE"; } objRptTextCntr.Gf_DrawText(Report, RptControl.TextAlign.Center, len, false); objRptTextCntr.GF_AddNewLine(1); objRptTextCntr.GF_DrawLine(len); objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("DATE", RptControl.TextAlign.Center, 9, true); objRptTextCntr.Gf_DrawText("NAME", RptControl.TextAlign.Center, 14, true); objRptTextCntr.Gf_DrawText("ITEM", RptControl.TextAlign.Center, 15, true); objRptTextCntr.Gf_DrawText("WEIGHT", RptControl.TextAlign.Center, 9, true); objRptTextCntr.Gf_DrawText("TOUCH", RptControl.TextAlign.Center, 9, true); objRptTextCntr.Gf_DrawText("DESCRIPTION", RptControl.TextAlign.Center, 34, true); objRptTextCntr.GF_AddNewLine(1); objRptTextCntr.GF_DrawLine(len); for (int i = 0; i < _rpt.Rows.Count - 1; i++) { objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText(_rpt.Rows[i]["dt"], RptControl.TextAlign.Left, 9, true); objRptTextCntr.Gf_DrawText(_rpt.Rows[i]["nam"], RptControl.TextAlign.Left, 14, true); objRptTextCntr.Gf_DrawText(_rpt.Rows[i]["itm"], RptControl.TextAlign.Left, 15, true); objRptTextCntr.Gf_DrawText(_rpt.Rows[i]["nw"], RptControl.TextAlign.Right, 9, true, "F3"); objRptTextCntr.Gf_DrawText(_rpt.Rows[i]["dft"], RptControl.TextAlign.Right, 9, true, "F3"); objRptTextCntr.Gf_DrawText(_rpt.Rows[i]["dsc"], RptControl.TextAlign.Left, 34, true); objRptTextCntr.GF_AddNewLine(1); } objRptTextCntr.GF_DrawLine(len); objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Center, 9, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 14, true); objRptTextCntr.Gf_DrawText("TOTAL", RptControl.TextAlign.Right, 15, true); objRptTextCntr.Gf_DrawText(_wt, RptControl.TextAlign.Right, 9, true, "F3"); objRptTextCntr.Gf_DrawText(_tch, RptControl.TextAlign.Right, 9, true, "F3"); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 34, true); objRptTextCntr.GF_AddNewLine(1); objRptTextCntr.GF_DrawLine(len); _printData = objRptTextCntr.GF_GetPrintString(); this.GetPrinters(); }
private String GetFirstPrintString(DataTable master, DataTable detail) { try { int len = 92; RptControl.RptTextCntrl objRptTextCntr = new RptControl.RptTextCntrl(); for (int i = 0; i < master.Rows.Count; i++) { string itemId = PLABS.Utils.CnvToStr(master.Rows[i]["id"]); string itemName = PLABS.Utils.CnvToStr(master.Rows[i]["grp"]); DataRow[] sortDetailWithMaster = detail.Select("id= '" + itemId + "'"); if (sortDetailWithMaster.Length != 0) { double bal = 0.00; for (int j = 0; j < sortDetailWithMaster.Length; j++) { DataRow row = sortDetailWithMaster[j]; if (j == 0) { objRptTextCntr.Gf_DrawText(itemName, RptControl.TextAlign.Center, len, false); objRptTextCntr.GF_AddNewLine(0); objRptTextCntr.GF_DrawLine(len); objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("Date", RptControl.TextAlign.Center, 13, true); objRptTextCntr.Gf_DrawText("Buyer", RptControl.TextAlign.Center, 12, true); objRptTextCntr.Gf_DrawText("Purchase gold", RptControl.TextAlign.Center, 12, true); objRptTextCntr.Gf_DrawText("Issue gold", RptControl.TextAlign.Center, 12, true); objRptTextCntr.Gf_DrawText("Purchase WT", RptControl.TextAlign.Center, 13, true); objRptTextCntr.Gf_DrawText("Issue WT", RptControl.TextAlign.Center, 12, true); objRptTextCntr.Gf_DrawText("Balance", RptControl.TextAlign.Center, 12, true); objRptTextCntr.GF_AddNewLine(0); objRptTextCntr.GF_DrawLine(len); } string dat = ""; dat = PLABS.Utils.CnvToDate(row["dt"]).ToString("dd-MMM-yyyy"); objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText(dat, RptControl.TextAlign.Left, 13, true); objRptTextCntr.Gf_DrawText(PLABS.Utils.CnvToStr(row["nam"]), RptControl.TextAlign.Left, 12, true); if (PLABS.Utils.CnvToDouble(row["gw"]) > 0) { objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText(PLABS.Utils.CnvToStr(row["gld"]), RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 13, true); objRptTextCntr.Gf_DrawText(PLABS.Utils.CnvToDouble(row["gw"]).ToString("N3"), RptControl.TextAlign.Right, 12, true); bal += PLABS.Utils.CnvToDouble(row["gw"]); } else if (PLABS.Utils.CnvToDouble(row["gw"]) < 0) { objRptTextCntr.Gf_DrawText(PLABS.Utils.CnvToStr(row["gld"]), RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText((-1 * PLABS.Utils.CnvToDouble(row["gw"])).ToString("F3"), RptControl.TextAlign.Right, 13, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 12, true); bal += PLABS.Utils.CnvToDouble(row["gw"]); } objRptTextCntr.Gf_DrawText(bal.ToString("N3"), RptControl.TextAlign.Right, 12, true); objRptTextCntr.GF_AddNewLine(0); if (j == sortDetailWithMaster.Length - 1) { int n = 0; while (n < 3) { objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 13, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 13, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 12, true); objRptTextCntr.GF_AddNewLine(0); n++; } objRptTextCntr.GF_DrawLine(len); objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("Total", RptControl.TextAlign.Right, 26, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Right, 12, true, "F3"); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Right, 12, true, "F3"); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Right, 13, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Right, 12, true); objRptTextCntr.Gf_DrawText(bal.ToString("N3"), RptControl.TextAlign.Right, 12, true); objRptTextCntr.GF_AddNewLine(0); objRptTextCntr.GF_DrawLine(len); objRptTextCntr.GF_AddNewLine(2); } } } } return(objRptTextCntr.GF_GetPrintString()); } catch (Exception ex) { MessageBox.Show(ex.Message); } return(""); }
private void LoadReport() { try { int PAGE_WIDTH = 111; DataTable dgvDt = (DataTable)grd_data.DataSource; // DataTable dgvDt_Head = dgvDt.Clone(); RptControl.RptTextCntrl objRptTextCntrl = new RptControl.RptTextCntrl(); objRptTextCntrl.GV_TopMargineLineCnt = 5; objRptTextCntrl.GV_BottomMargineLineCnt = 5; objRptTextCntrl.GV_LeftMargineLineCnt = 3; #region HEADER //objRptTextCntrl.Gf_DrawText("Weight Ledger", RptControl.TextAlign.Center, PAGE_WIDTH, false); //objRptTextCntrl.GF_AddNewLine(2); objRptTextCntrl.Gf_DrawText("Group : " + fnd_Grup.SelectedCode + " To : " + fnd_addr.SelectedCode, RptControl.TextAlign.Left, PAGE_WIDTH, false); objRptTextCntrl.GF_AddNewLine(2); objRptTextCntrl.Gf_DrawText("From Date : " + dtp_frm.Value.Date.ToShortDateString() + " To Date : " + dtp_to.Value.ToShortDateString(), RptControl.TextAlign.Left, PAGE_WIDTH, false); objRptTextCntrl.GF_AddNewLine(2); #endregion #region DETAILS HEADER objRptTextCntrl.GF_DrawLine(PAGE_WIDTH); objRptTextCntrl.Gf_AddSeperator(); objRptTextCntrl.Gf_DrawText("DATE", RptControl.TextAlign.Center, 10, true); objRptTextCntrl.Gf_DrawText("ITEM", RptControl.TextAlign.Center, 22, true); objRptTextCntrl.Gf_DrawText("WT", RptControl.TextAlign.Center, 8, true); objRptTextCntrl.Gf_DrawText("ISSUE", RptControl.TextAlign.Center, 8, true); objRptTextCntrl.Gf_DrawText("RECEIPT", RptControl.TextAlign.Center, 8, true); objRptTextCntrl.Gf_DrawText("MC", RptControl.TextAlign.Center, 10, true); objRptTextCntrl.Gf_DrawText("MCRATE", RptControl.TextAlign.Center, 8, true); objRptTextCntrl.Gf_DrawText("PAYMENT", RptControl.TextAlign.Center, 12, true); objRptTextCntrl.Gf_DrawText("RECEIPT", RptControl.TextAlign.Center, 12, true); objRptTextCntrl.Gf_DrawText("USER", RptControl.TextAlign.Center, 4, true); objRptTextCntrl.GF_AddNewLine(0); objRptTextCntrl.GF_DrawLine(PAGE_WIDTH); #endregion #region DETAILS DATA int itemCount = dgvDt.Rows.Count; for (int i = 0; i < itemCount; i++) { String WT = String.Empty; String ISSUE = String.Empty; String RECEIPT = String.Empty; String MC = String.Empty; String MCRATE = String.Empty; String PAYMENT = String.Empty; String RECEIPT1 = String.Empty; String DATE = PLABS.Utils.CnvToSentenceCase(PLABS.Utils.CnvToStr(dgvDt.Rows[i]["date"])); String ITEM = PLABS.Utils.CnvToSentenceCase(PLABS.Utils.CnvToStr(dgvDt.Rows[i]["item"])); if (PLABS.Utils.CnvToStr(dgvDt.Rows[i]["wt"]) == "") { WT = ""; } else { WT = PLABS.Utils.CnvToSentenceCase(PLABS.Utils.CnvToDouble(dgvDt.Rows[i]["wt"]).ToString("F3")); } if (PLABS.Utils.CnvToStr(dgvDt.Rows[i]["isswt"]) == "") { ISSUE = ""; } else { ISSUE = PLABS.Utils.CnvToSentenceCase(PLABS.Utils.CnvToDouble(dgvDt.Rows[i]["isswt"]).ToString("F3")); } if (PLABS.Utils.CnvToStr(dgvDt.Rows[i]["recwt"]) == "") { RECEIPT = ""; } else { RECEIPT = PLABS.Utils.CnvToSentenceCase(PLABS.Utils.CnvToDouble(dgvDt.Rows[i]["recwt"]).ToString("F3")); } if (PLABS.Utils.CnvToStr(dgvDt.Rows[i]["mc"]) == "") { MC = ""; } else { MC = PLABS.Utils.CnvToSentenceCase(PLABS.Utils.CnvToStr(dgvDt.Rows[i]["mc"])); } if (PLABS.Utils.CnvToStr(dgvDt.Rows[i]["mcrt"]) == "") { MCRATE = ""; } else { MCRATE = PLABS.Utils.CnvToSentenceCase(PLABS.Utils.CnvToDouble(dgvDt.Rows[i]["mcrt"]).ToString("F3")); } if (PLABS.Utils.CnvToStr(dgvDt.Rows[i]["dr"]) == "") { PAYMENT = ""; } else { PAYMENT = PLABS.Utils.CnvToSentenceCase(PLABS.Utils.CnvToDouble(dgvDt.Rows[i]["dr"]).ToString("F3")); } if (PLABS.Utils.CnvToStr(dgvDt.Rows[i]["cr"]) == "") { RECEIPT1 = ""; } else { RECEIPT1 = PLABS.Utils.CnvToSentenceCase(PLABS.Utils.CnvToDouble(dgvDt.Rows[i]["cr"]).ToString("F3")); } String USER = PLABS.Utils.CnvToStr(dgvDt.Rows[i]["usr_nam"]); objRptTextCntrl.Gf_AddSeperator(); objRptTextCntrl.Gf_DrawText(" " + DATE, RptControl.TextAlign.Left, 10, true); objRptTextCntrl.Gf_DrawText(" " + ITEM, RptControl.TextAlign.Left, 22, true); objRptTextCntrl.Gf_DrawText(" " + WT, RptControl.TextAlign.Right, 8, true); objRptTextCntrl.Gf_DrawText(" " + ISSUE, RptControl.TextAlign.Right, 8, true); objRptTextCntrl.Gf_DrawText(" " + RECEIPT, RptControl.TextAlign.Right, 8, true); objRptTextCntrl.Gf_DrawText(" " + MC, RptControl.TextAlign.Right, 10, true); objRptTextCntrl.Gf_DrawText(" " + MCRATE, RptControl.TextAlign.Right, 8, true); objRptTextCntrl.Gf_DrawText(" " + PAYMENT, RptControl.TextAlign.Right, 12, true); objRptTextCntrl.Gf_DrawText(" " + RECEIPT1, RptControl.TextAlign.Right, 12, true); objRptTextCntrl.Gf_DrawText(" " + USER, RptControl.TextAlign.Right, 4, true); objRptTextCntrl.GF_AddNewLine(0); if (i == itemCount - 2) { //objRptTextCntrl.GF_AddNewLine(1); objRptTextCntrl.GF_DrawLine(PAGE_WIDTH); } } objRptTextCntrl.GF_DrawLine(PAGE_WIDTH); #endregion #region FOOTER //objRptTextCntrl.Gf_AddSeperator(); //objRptTextCntrl.Gf_DrawText("Weight " + txt_wgt.Text + " Cash " + txt_cash.Text, RptControl.TextAlign.Left, PAGE_WIDTH, false); #endregion _printRpt = objRptTextCntrl.GF_GetPrintString(); // DRAFT PRINT /* * String path = "D:\\Print.txt"; * if (File.Exists(path)) * { * File.Delete(path); * } * * System.IO.File.WriteAllText(path, _printRpt); * string mode = "/d:lpt1:"; * * * DraftPrint_cmd(path, mode); * */ // USB PRINT GetPrinters(); } catch (Exception ex) { PLABS.MessageBoxPL.Show(ex.Message); } }
public void print(DataTable rpt) { int len = 105;//previous 88 double ttl_prty_wt = 0; double ttlGain = 0.00; string header = this.header(); RptControl.RptTextCntrl objRptTextCntr = new RptControl.RptTextCntrl(); objRptTextCntr.GF_DrawLine(len); objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("Date", RptControl.TextAlign.Center, 11, true); objRptTextCntr.Gf_DrawText("Smith Name", RptControl.TextAlign.Center, 10, true); objRptTextCntr.Gf_DrawText("Receipt Gold Name", RptControl.TextAlign.Center, 17, true); objRptTextCntr.Gf_DrawText("Purity", RptControl.TextAlign.Center, 7, true); objRptTextCntr.Gf_DrawText("WT", RptControl.TextAlign.Center, 9, true); objRptTextCntr.Gf_DrawText("Pure WT", RptControl.TextAlign.Center, 7, true); objRptTextCntr.Gf_DrawText("Making Charge", RptControl.TextAlign.Center, 15, true);//modified here objRptTextCntr.Gf_DrawText("Description", RptControl.TextAlign.Center, 12, true); objRptTextCntr.Gf_DrawText("Gain", RptControl.TextAlign.Center, 9, true); objRptTextCntr.GF_AddNewLine(0); objRptTextCntr.GF_DrawLine(len); int i = 0; while (i < rpt.Rows.Count) { double wt = 0; wt = Convert.ToDouble(rpt.Rows[i]["grs_wgt"]); double purty = 0; purty = Convert.ToDouble(rpt.Rows[i]["purty"]); double pur_wt = 0; pur_wt = (purty * wt) / 100; objRptTextCntr.Gf_AddSeperator(); DateTime date = PLABS.Utils.CnvToDate(rpt.Rows[i]["date"]); string Date = date.Day.ToString() + "/" + date.Month.ToString() + "/" + date.Year.ToString(); objRptTextCntr.Gf_DrawText(Date, RptControl.TextAlign.Left, 11, true); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["addr_nam"], RptControl.TextAlign.Left, 10, true); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["itm_name"], RptControl.TextAlign.Left, 17, true); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["purty"], RptControl.TextAlign.Right, 7, true, "F2"); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["grs_wgt"], RptControl.TextAlign.Right, 9, true, "F3"); objRptTextCntr.Gf_DrawText(pur_wt, RptControl.TextAlign.Right, 7, true, "F3"); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["mc"], RptControl.TextAlign.Right, 15, true, "F3"); objRptTextCntr.Gf_DrawText(rpt.Rows [i]["descr"], RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["Gain"], RptControl.TextAlign.Right, 9, true); objRptTextCntr.GF_AddNewLine(0); ttlGain += PLABS.Utils.CnvToDouble(rpt.Rows[i]["Gain"]); ttl_prty_wt += pur_wt; i++; } int n = 0; while (n < 5) { objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 11, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 10, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 17, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 7, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 9, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 7, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 15, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 9, true); objRptTextCntr.GF_AddNewLine(0); n++; } objRptTextCntr.GF_DrawLine(len); objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("Total", RptControl.TextAlign.Right, 58, true); objRptTextCntr.Gf_DrawText(ttl_prty_wt, RptControl.TextAlign.Right, 7, true, "F3"); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Right, 15, true); objRptTextCntr.Gf_DrawText(ttlGain.ToString("N3"), RptControl.TextAlign.Right, 22, true); objRptTextCntr.GF_AddNewLine(0); objRptTextCntr.GF_DrawLine(len); string print = header; print += objRptTextCntr.GF_GetPrintString(); rtxt_smthrecpt.Text = print; }
public void print(DataTable rpt) { int len = 92; //double wt = 0; //double rate = 0; double purewt = 0; double pureWtForAvgRt = 0; //double weight = 0; double rte = 0; double ttlrt = 0; RptControl.RptTextCntrl objRptTextCntr = new RptControl.RptTextCntrl(); objRptTextCntr.GF_AddNewLine(1); objRptTextCntr.Gf_DrawText("RAW PARCHASE", RptControl.TextAlign.Center, len, false); objRptTextCntr.GF_AddNewLine(1); objRptTextCntr.GF_DrawLine(len); objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("DATE", RptControl.TextAlign.Center, 11, true); objRptTextCntr.Gf_DrawText("PARCHASER", RptControl.TextAlign.Center, 10, true); objRptTextCntr.Gf_DrawText("GOLD NAME", RptControl.TextAlign.Center, 10, true); objRptTextCntr.Gf_DrawText("PURITY", RptControl.TextAlign.Center, 6, true); objRptTextCntr.Gf_DrawText("GOLD WT", RptControl.TextAlign.Center, 8, true); objRptTextCntr.Gf_DrawText("RATE/GRM", RptControl.TextAlign.Center, 9, true); objRptTextCntr.Gf_DrawText("PURE WT", RptControl.TextAlign.Center, 7, true); objRptTextCntr.Gf_DrawText("TOTAL RATE", RptControl.TextAlign.Center, 11, true); objRptTextCntr.Gf_DrawText("DESCRIPTION", RptControl.TextAlign.Center, 12, true); objRptTextCntr.GF_AddNewLine(0); objRptTextCntr.GF_DrawLine(len); for (int i = 0; i < rpt.Rows.Count; i++) { string dat = ""; dat = PLABS.Utils.CnvToDate(rpt.Rows[i]["date"]).ToString("dd-MMM-yyyy"); objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText(dat, RptControl.TextAlign.Left, 11, true); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["addr_nam"], RptControl.TextAlign.Left, 10, true); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["gold"], RptControl.TextAlign.Left, 10, true); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["purty"], RptControl.TextAlign.Right, 6, true, "F2"); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["wt"], RptControl.TextAlign.Right, 8, true, "F3"); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["rate"], RptControl.TextAlign.Right, 9, true, "F2"); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["purewt"], RptControl.TextAlign.Right, 7, true, "F3"); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["ttlamt"], RptControl.TextAlign.Right, 11, true, "F2"); objRptTextCntr.Gf_DrawText(rpt.Rows[i]["descr"], RptControl.TextAlign.Left, 12, true); //objRptTextCntr.Gf_DrawText("Total", RptControl.TextAlign.Right, 11, true, "F2"); objRptTextCntr.GF_AddNewLine(0); //wt += Convert.ToDouble(rpt.Rows[i]["wt"]); //rate += Convert.ToDouble(rpt.Rows[i]["rate"]); purewt += Convert.ToDouble(rpt.Rows[i]["purewt"]); if (PLABS.Utils.CnvToInt(rpt.Rows[i]["vou_typ_id"]) == PLABS.Utils.CnvToInt(Enums.VoucherType.RawPurchase)) { pureWtForAvgRt += PLABS.Utils.CnvToDouble(rpt.Rows[i]["purewt"]); } ttlrt += PLABS.Utils.CnvToDouble(rpt.Rows [i]["ttlamt"]); //cnt++; } int n = 0; while (n < 3) { objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 11, true); //objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 15, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 10, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 10, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 6, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 8, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 9, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 7, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 11, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 12, true); objRptTextCntr.GF_AddNewLine(0); n++; } objRptTextCntr.GF_DrawLine(len); objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Center, 11, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 10, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 10, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Right, 6, true); objRptTextCntr.Gf_DrawText("TOTAL", RptControl.TextAlign.Right, 8, true); objRptTextCntr.Gf_DrawText(ttlrt / pureWtForAvgRt, RptControl.TextAlign.Right, 9, true, "F2"); objRptTextCntr.Gf_DrawText(purewt, RptControl.TextAlign.Right, 7, true, "F3"); objRptTextCntr.Gf_DrawText(ttlrt, RptControl.TextAlign.Right, 11, true, "F2"); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Right, 12, true); objRptTextCntr.GF_AddNewLine(0); objRptTextCntr.GF_DrawLine(len); string print = objRptTextCntr.GF_GetPrintString(); rtxt_purchase.Text = print; //} }
public void print(DataTable master, DataTable detail) { int len = 88; double iss_wt = 0; double rcpt_wt = 0; RptControl.RptTextCntrl objRptTextCntr = new RptControl.RptTextCntrl(); for (int j = 0; j < master.Rows.Count; j++) { int k = 0; double issrecwt = 0.00; double ttl = 0.00; string shp_nam = ""; shp_nam = PLABS.Utils.CnvToStr(master.Rows[j]["addr_nam"]); objRptTextCntr.GF_AddNewLine(1); for (int i = 0; i < detail.Rows.Count; i++) { string pur_nam = ""; pur_nam = PLABS.Utils.CnvToStr(detail.Rows[i]["smith"]); if (shp_nam == pur_nam) { if (k == 0) { objRptTextCntr.Gf_DrawText(pur_nam, RptControl.TextAlign.Center, len, false); objRptTextCntr.GF_AddNewLine(0); objRptTextCntr.GF_DrawLine(len); objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("Date", RptControl.TextAlign.Center, 13, true); objRptTextCntr.Gf_DrawText("Item Name", RptControl.TextAlign.Center, 12, true); objRptTextCntr.Gf_DrawText("purity", RptControl.TextAlign.Center, 13, true); objRptTextCntr.Gf_DrawText("Issue Weight", RptControl.TextAlign.Center, 12, true); objRptTextCntr.Gf_DrawText("Reciept Weight", RptControl.TextAlign.Center, 12, true); objRptTextCntr.Gf_DrawText("MC", RptControl.TextAlign.Center, 8, true); objRptTextCntr.Gf_DrawText("Balance", RptControl.TextAlign.Center, 12, true); objRptTextCntr.GF_AddNewLine(0); objRptTextCntr.GF_DrawLine(len); k++; iss_wt = 0; rcpt_wt = 0; } string dat = ""; dat = PLABS.Utils.CnvToDate(detail.Rows[i]["date"]).ToString("dd-MMM-yyyy"); objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText(dat, RptControl.TextAlign.Left, 13, true); objRptTextCntr.Gf_DrawText(detail.Rows[i]["gold"], RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText(detail.Rows[i]["purty"], RptControl.TextAlign.Right, 13, true, "F2"); if (detail.Rows[i]["vou_typ_id"].ToString() == "2") { rcpt_wt += Convert.ToDouble(detail.Rows[i]["grs_wgt"]); objRptTextCntr.Gf_DrawText(" ", RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText(detail.Rows[i]["grs_wgt"], RptControl.TextAlign.Right, 12, true, "F3"); objRptTextCntr.Gf_DrawText(detail.Rows[i]["mc"], RptControl.TextAlign.Right, 8, true, "F3"); if (PLABS.Utils.CnvToStr(detail.Rows[i]["mc_ratio"]) == "2") { issrecwt -= Convert.ToDouble(detail.Rows[i]["grs_wgt"]) + Convert.ToDouble(detail.Rows[i]["mc"]); } else { issrecwt -= Convert.ToDouble(detail.Rows[i]["grs_wgt"]); } } else if (detail.Rows[i]["vou_typ_id"].ToString() == "1") { iss_wt += Convert.ToDouble(detail.Rows[i]["grs_wgt"]); objRptTextCntr.Gf_DrawText(detail.Rows[i]["grs_wgt"], RptControl.TextAlign.Right, 12, true, "F3"); objRptTextCntr.Gf_DrawText(" ", RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Right, 8, true); issrecwt += Convert.ToDouble(detail.Rows[i]["grs_wgt"]); } ttl += Convert.ToDouble(detail.Rows[i]["grs_wgt"]); objRptTextCntr.Gf_DrawText(issrecwt.ToString("N3"), RptControl.TextAlign.Right, 12, true); objRptTextCntr.GF_AddNewLine(0); } if (i == detail.Rows.Count - 1) { int n = 0; while (n < 3) { objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 13, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 13, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 12, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 8, true); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Left, 12, true); objRptTextCntr.GF_AddNewLine(0); n++; } objRptTextCntr.GF_DrawLine(len); objRptTextCntr.Gf_AddSeperator(); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Right, 26, true); objRptTextCntr.Gf_DrawText("Total", RptControl.TextAlign.Right, 13, true); objRptTextCntr.Gf_DrawText(iss_wt, RptControl.TextAlign.Right, 12, true, "F3"); objRptTextCntr.Gf_DrawText(rcpt_wt, RptControl.TextAlign.Right, 12, true, "F3"); objRptTextCntr.Gf_DrawText("", RptControl.TextAlign.Right, 8, true); objRptTextCntr.Gf_DrawText(issrecwt.ToString("N3"), RptControl.TextAlign.Right, 12, true); objRptTextCntr.GF_AddNewLine(0); objRptTextCntr.GF_DrawLine(len); } } string print = objRptTextCntr.GF_GetPrintString(); this.rtxt_purchase.Text = print; } }