private void btnPrint_Click(object sender, EventArgs e) { //Print Selected Transaction //string custtypetoid = radGridView1.SelectedRows[0].Cells["custtypetoid"].Value.ToString(); string iLogID = radGridView1.SelectedRows[0].Cells["LogID"].Value.ToString(); //Print DialogResult res = MessageBox.Show("Siapkan kertas untuk print.", "SMS - Verification" , MessageBoxButtons.OKCancel , MessageBoxIcon.Question); if (res == System.Windows.Forms.DialogResult.OK) { PrinterSettings printerSettings; ReportProcessor reportProcessor; rptTM rpt = new rptTM(); rpt.ReportParameters["user"].Value = NBConfig.ValidUserName; rpt.ReportParameters["logid"].Value = lblLogID.Text; //rpt.ReportParameters["custtypetoid"].Value = custtypetoid; IReportDocument iRpt = (IReportDocument)rpt; //// PrinterSettings printerSettings = new PrinterSettings(); //// Adjust the printer settings if necessary... // Print the report using the printer settings. try { reportProcessor = new ReportProcessor(); reportProcessor.PrintReport(iRpt, printerSettings); using (sinarekDataSetTableAdapters.logproductTableAdapter tbl = new sinarekDataSetTableAdapters.logproductTableAdapter()) { tbl.UpdatePrinted(NBConfig.ValidUserName, long.Parse(lblLogID.Text)); } } catch (Exception ex) { MessageBox.Show(ex.Message, "SMS - Error Notofication"); } } }
private void SaveNewItem(short StatusID, bool print) { string iLogID = string.Empty; string mobil = string.Empty , sopir = string.Empty , keterangan = null; int kernetid = -1 , sopirid = -1 , mobilid = -1 , kotaid = -1 , salesid = -1 , custid = -1 //, custtypetoid = -1 , transtypeid = -1 , custtypeid = -1; int paid = 0; //DataRow[] dr = this.sinarekDataSet.custtype.Select("name = 'gudang barang'"); transtypeid = int.Parse(radGridView1.Rows[0].Cells["custtypeid"].Value.ToString()); //dr = this.sinarekDataSet.custtype.Select("name = 'supplier'"); custtypeid = int.Parse(rddSup.Tag.ToString()); mobil = txtAntar.Text; string[] sep = { "_" }; custid = int.Parse(rddSup.SelectedValue.ToString().Split(sep, StringSplitOptions.RemoveEmptyEntries)[0]); using (sinarekDataSetTableAdapters.logproductTableAdapter tbl = new sinarekDataSetTableAdapters.logproductTableAdapter()) { //Always Create with status created iLogID = tbl.pInsertLogProd(tanggalDateTimePicker.Value , 1 , kernetid , sopirid , mobilid , kotaid , salesid , mobil , sopir , keterangan , custid , custtypeid , transtypeid , NBConfig.ValidUserName , StatusID, paid, 0).ToString(); } foreach (GridViewRowInfo item in radGridView1.Rows) { using (sinarekDataSetTableAdapters.logdetailTableAdapter tbl = new sinarekDataSetTableAdapters.logdetailTableAdapter()) { try { tbl.pInsertLogOther(int.Parse(iLogID) , item.Cells["keterangan"].Value.ToString() , 0 , int.Parse(item.Cells["custtypeid"].Value.ToString()) , int.Parse(item.Cells["custtypetoid"].Value.ToString()) , null , decimal.Parse(item.Cells["quantity"].Value.ToString()) , int.Parse(item.Cells["productid"].Value.ToString()) , int.Parse(item.Cells["status"].Value.ToString()) , decimal.Parse(item.Cells["harga"].Value.ToString()) , NBConfig.ValidUserName); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } MessageBox.Show("Data sudah terinput.", "SMS"); //Print DialogResult res = MessageBox.Show("Siapkan kertas untuk print.", "SMS - Verification" , MessageBoxButtons.OKCancel , MessageBoxIcon.Question); if (res == System.Windows.Forms.DialogResult.OK) { PrinterSettings printerSettings; ReportProcessor reportProcessor; rptTM rpt = new rptTM(); rpt.ReportParameters["user"].Value = NBConfig.ValidUserName; rpt.ReportParameters["logid"].Value = iLogID; IReportDocument iRpt = (IReportDocument)rpt; //// PrinterSettings printerSettings = new PrinterSettings(); //// Adjust the printer settings if necessary... InstanceReportSource reportSource = new InstanceReportSource(); reportSource.ReportDocument = rpt; // Print the report using the printer settings. reportProcessor = new ReportProcessor(); reportProcessor.PrintReport(reportSource, printerSettings); using (sinarekDataSetTableAdapters.logproductTableAdapter tbl = new sinarekDataSetTableAdapters.logproductTableAdapter()) { tbl.UpdatePrinted(NBConfig.ValidUserName, long.Parse(iLogID)); } } else { MessageBox.Show("Transaksi masuk ini dapat dilihat di daftar transaksi yg belum di print."); } }
private void btnPrint_Click(object sender, EventArgs e) { //check printed bool printed = false; //if printed //Print Selected Transaction //string custtypetoid = radGridView1.SelectedRows[0].Cells["custtypetoid"].Value.ToString(); string iLogID = radGridView1.SelectedRows[0].Cells["LogID"].Value.ToString(); //Print using (sinarekDataSetTableAdapters.logproductTableAdapter tbl = new sinarekDataSetTableAdapters.logproductTableAdapter()) { printed = (bool)tbl.CheckPrinted(long.Parse(iLogID)); } string frmName = this.GetType().Name; bool edit = NBConfig.CheckPermission((this.Tag != null ? this.Tag.ToString() : ""), frmName, "delete"); if (!edit) { if (printed) { helper.NotifMessage("Transaksi Sudah di Print!"); return; } } //Print DialogResult res = MessageBox.Show("Siapkan kertas untuk print.", "SMS - Verification" , MessageBoxButtons.OKCancel , MessageBoxIcon.Question); if (res == System.Windows.Forms.DialogResult.OK) { PrinterSettings printerSettings; ReportProcessor reportProcessor; rptTM rpt = new rptTM(); rpt.ReportParameters["user"].Value = NBConfig.ValidUserName; rpt.ReportParameters["logid"].Value = lblLogID.Text; //rpt.ReportParameters["custtypetoid"].Value = custtypetoid; IReportDocument iRpt = (IReportDocument)rpt; //// PrinterSettings printerSettings = new PrinterSettings(); //// Adjust the printer settings if necessary... // Print the report using the printer settings. try { InstanceReportSource reportSource = new InstanceReportSource(); reportSource.ReportDocument = iRpt; reportProcessor = new ReportProcessor(); reportProcessor.PrintReport(reportSource, printerSettings); using (sinarekDataSetTableAdapters.logproductTableAdapter tbl = new sinarekDataSetTableAdapters.logproductTableAdapter()) { tbl.UpdatePrinted(NBConfig.ValidUserName, long.Parse(lblLogID.Text)); } helper.PrintLog(this.GetType().Name, rpt.Name, this.Text + ":LogID-" + iLogID); } catch (Exception ex) { MessageBox.Show(ex.Message, "SMS - Error Notofication"); } } }