private void SaveEditItem(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; short custtypetoid = -1 , custtypeid = -1; int paid = 0; DataRow[] dr = this.sinarekDataSet.custtype.Select("name = 'gudang barang'"); custtypetoid = short.Parse(dr[0]["custtypeid"].ToString()); dr = this.sinarekDataSet.custtype.Select("name = 'supplier'"); custtypeid = short.Parse(dr[0]["custtypeid"].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 , 1 , kernetid , sopirid , mobilid , kotaid , salesid , mobil , sopir , keterangan , custid , custtypetoid , custtypetoid , NBConfig.ValidUserName , StatusID, paid, 0).ToString(); } foreach (GridViewRowInfo item in radGridView1.Rows) { using (sinarekDataSetTableAdapters.logotherTableAdapter tbl = new sinarekDataSetTableAdapters.logotherTableAdapter()) { try { tbl.InsertLogOtherDetail(int.Parse(iLogID) , item.Cells["keterangan"].Value.ToString() , 0 , custtypeid , null , decimal.Parse(item.Cells["quantity"].Value.ToString()) , int.Parse(item.Cells["productid"].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; rpt.ReportParameters["custtypetoid"].Value = 18; 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); } else { MessageBox.Show("Transaksi masuk ini dapat dilihat di daftar transaksi yg belum di print."); } }
private void SaveEditItem(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; short custtypetoid = -1 , custtypeid = -1; int paid = 0; DataRow[] dr = this.sinarekDataSet.custtype.Select("name = 'gudang barang'"); custtypetoid = short.Parse(dr[0]["custtypeid"].ToString()); dr = this.sinarekDataSet.custtype.Select("name = 'supplier'"); custtypeid = short.Parse(dr[0]["custtypeid"].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 , 1 , kernetid , sopirid , mobilid , kotaid , salesid , mobil , sopir , keterangan , custid , custtypetoid , custtypetoid , NBConfig.ValidUserName , StatusID, paid, 0).ToString(); } foreach (GridViewRowInfo item in radGridView1.Rows) { using (sinarekDataSetTableAdapters.logotherTableAdapter tbl = new sinarekDataSetTableAdapters.logotherTableAdapter()) { try { tbl.InsertLogOtherDetail(int.Parse(iLogID) , item.Cells["keterangan"].Value.ToString() , 0 , custtypeid , null , decimal.Parse(item.Cells["quantity"].Value.ToString()) , int.Parse(item.Cells["productid"].Value.ToString()) , decimal.Parse(item.Cells["harga"].Value.ToString()) , 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."); }