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 , custtypeid = -1; int paid = 0; if (custtype_ != "Botol") { DataRow[] dr = this.sinarekDataSet.custtype.Select("name = '" + custtype_ + "'"); custtypetoid = int.Parse(dr[0]["custtypeid"].ToString()); //dr = this.sinarekDataSet.custtype.Select("name = 'supplier'"); custtypeid = int.Parse(rddSup.Tag.ToString()); } else { custtypetoid = int.Parse(rddSup.Tag.ToString()); } if (chkAntar.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On) { sopirid = int.Parse(rddPelSopir.SelectedValue.ToString()); mobilid = int.Parse(rddPelMobil.SelectedValue.ToString()); kernetid = int.Parse(rddPelKernet.SelectedValue.ToString()); kotaid = int.Parse(rddTujuan.SelectedValue.ToString()); } 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 , 0 , kernetid , sopirid , mobilid , kotaid , custtypeid , mobil , sopir , keterangan , custid , custtypetoid , custtypetoid , NBConfig.ValidUserName , StatusID, paid, 0).ToString(); } custtypetoid = int.Parse(rddSup.Tag.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()) , custtypetoid , 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; rptSJ rpt = new rptSJ(); 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... // Print the report using the printer settings. reportProcessor = new ReportProcessor(); reportProcessor.PrintReport(iRpt, printerSettings); using (sinarekDataSetTableAdapters.logproductTableAdapter tbl = new sinarekDataSetTableAdapters.logproductTableAdapter()) { tbl.UpdatePrinted(NBConfig.ValidUserName, long.Parse(iLogID)); } helper.PrintLog(this.GetType().Name, rpt.Name, this.Text + ":LogID-" + iLogID); } else { MessageBox.Show("Transaksi masuk ini dapat dilihat di daftar transaksi yg belum di print."); } }
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 , custid = -1 , custtypeid = -1; int paid = 0; custtypeid = int.Parse(rddSup.Tag.ToString()); string[] sep = { "_" }; custid = int.Parse(rddSup.SelectedValue.ToString()); using (sinarekDataSetTableAdapters.logproductTableAdapter tbl = new sinarekDataSetTableAdapters.logproductTableAdapter()) { //Always Create with status created iLogID = tbl.pInsertLogProdChild(dtpTanggal.Value , parentid_ , 0 , kernetid , sopirid , mobilid , kotaid , custid , 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() , (int.Parse(item.Cells["status"].Value.ToString()) == 5 ? 1 : 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()) , 0 , NBConfig.ValidUserName); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } RadMessageBox.Show("Data sudah terinput.", "SMS"); //Print DialogResult res = RadMessageBox.Show("Siapkan kertas untuk print.", "SMS - Verification" , MessageBoxButtons.OKCancel , RadMessageIcon.Question , MessageBoxDefaultButton.Button1); if (res == System.Windows.Forms.DialogResult.OK) { PrinterSettings printerSettings; ReportProcessor reportProcessor; rptSJ rpt = new rptSJ(); 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 = iRpt; // 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)); } helper.PrintLog(this.GetType().Name, rpt.Name, this.Text + ":LogID-" + iLogID); } else { MessageBox.Show("Transaksi masuk ini dapat dilihat di daftar transaksi yg belum di print."); } }
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 = '" + custType_ + "'"); transtypeid = int.Parse(dr[0]["custtypeid"].ToString()); if (custType_ == "pakai") { custid = int.Parse(rddSup.SelectedValue.ToString()); custtypeid = int.Parse(rddSup.Tag.ToString()); } //dr = this.sinarekDataSet.custtype.Select("name = 'supplier'"); using (sinarekDataSetTableAdapters.logproductTableAdapter tbl = new sinarekDataSetTableAdapters.logproductTableAdapter()) { //Always Create with status created iLogID = tbl.pInsertLogProd(dtpTanggal.Value , 1 , kernetid , sopirid , mobilid , kotaid , salesid , mobil , sopir , keterangan , custid , custtypeid , transtypeid , NBConfig.ValidUserName , StatusID, paid, 0).ToString(); } //custtypeid = int.Parse(rddSup.Tag.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() , (int.Parse(item.Cells["status"].Value.ToString()) == 5 ? 1 : 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()) , 0 , NBConfig.ValidUserName); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } helper.NotifMessage("Data sudah terinput.\nTransaksi masuk ini dapat dilihat di daftar transaksi yg belum di print."); }
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; string[] sep = { "_" }; custid = int.Parse(rddSup.SelectedValue.ToString().Split(sep, StringSplitOptions.RemoveEmptyEntries)[0]); custtypeid = int.Parse(rddSup.Tag.ToString()); if (custType_ == "Barang Return") { DataRow[] dr = this.sinarekDataSet.custtype.Select("name = 'return'"); transtypeid = int.Parse(dr[0]["custtypeid"].ToString()); //dr = this.sinarekDataSet.custtype.Select("name = 'supplier'"); salesid = custid; } else { transtypeid = custtypeid; } using (sinarekDataSetTableAdapters.logproductTableAdapter tbl = new sinarekDataSetTableAdapters.logproductTableAdapter()) { //Always Create with status created iLogID = tbl.pInsertLogProd(dtpTanggal.Value , 1 , kernetid , sopirid , mobilid , kotaid , salesid , mobil , sopir , keterangan , custid , custtypeid , transtypeid , NBConfig.ValidUserName , StatusID, paid, 0).ToString(); } custtypeid = int.Parse(rddSup.Tag.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() , (int.Parse(item.Cells["status"].Value.ToString()) == 5 ? 1 : 0) , transtypeid , int.Parse(item.Cells["custtypetoid"].Value.ToString()) , DateTime.Parse(item.Cells["expireddate"].Value.ToString()) , decimal.Parse(item.Cells["quantity"].Value.ToString()) , int.Parse(item.Cells["productid"].Value.ToString()) , int.Parse(item.Cells["status"].Value.ToString()) , 0 , 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 = iRpt; // 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."); } }