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 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 = 4; 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 , custtypeid = -1 , transtypeid = -1; int paid = 0; transtypeid = int.Parse(rddTipe.SelectedValue.ToString()); custtypeid = int.Parse(rddPel.Tag.ToString()); kotaid = int.Parse(rddTujuan.SelectedValue.ToString()); salesid = int.Parse(rddSales.SelectedValue.ToString()); if (chkAntar.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On) { sopirid = int.Parse(rddSopir.SelectedValue.ToString()); mobilid = int.Parse(rddMobil.SelectedValue.ToString()); kernetid = int.Parse(rddKernet.SelectedValue.ToString()); } else { sopir = txtSopir.Text; mobil = txtMobil.Text; } switch (rddTipe.Text.ToLower()) { case "pelanggan": case "staff": case "pegawai": case "satpam": case "campuran": custid = int.Parse(rddPel.SelectedValue.ToString()); break; case "sales": custid = int.Parse(rddSales.SelectedValue.ToString()); break; case "contoh": break; } using (sinarekDataSetTableAdapters.logproductTableAdapter tbl = new sinarekDataSetTableAdapters.logproductTableAdapter()) { //Always Create with status created iLogID = tbl.pInsertLogProd(tanggalDateTimePicker.Value , 0 , 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()) { tbl.pInsertLogDetail(int.Parse(iLogID) , int.Parse(item.Cells["productid"].Value.ToString()) , decimal.Parse(item.Cells["quantity"].Value.ToString()) , transtypeid , int.Parse(item.Cells["custtypeid"].Value.ToString()) , 1 , item.Cells["keterangan"].Value.ToString() , NBConfig.ValidUserName); } } 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; //rpt.ReportParameters["custtypetoid"].Value = rddTipe.SelectedValue; 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("Surat Jalan ini dapat dilihat di daftar surat jalan 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("Surat Jalan Sudah di Print"); return; } } 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 = lblLogID.Text; //rpt.ReportParameters["custtypetoid"].Value = custtypetoid; IReportDocument iRpt = (IReportDocument)rpt; //// PrinterSettings printerSettings = new PrinterSettings(); //printerSettings.PrinterName = rddPrinter.Text; //// 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); this.vlogproductTableAdapter.FillByTanggal(this.sinarekDataSet.vlogproduct, dtpTanggal.Value); } catch (Exception ex) { helper.ErrorMessage(ex.Message); } } }
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; int paid = 0; custtypetoid = int.Parse(rddTipe.SelectedValue.ToString()); kotaid = int.Parse(rddTujuan.SelectedValue.ToString()); salesid = int.Parse(rddPelSales.SelectedValue.ToString()); switch (rddTipe.Text.ToLower()) { case "pelanggan": custid = int.Parse(mrddPel.SelectedValue.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()); } else { sopir = txtSopir.Text; mobil = txtMobil.Text; } break; case "sales": salesid = int.Parse(rddSales.SelectedValue.ToString()); custid = int.Parse(rddSales.SelectedValue.ToString()); sopirid = int.Parse(rddSopir.SelectedValue.ToString()); mobilid = int.Parse(rddMobil.SelectedValue.ToString()); kernetid = int.Parse(rddKernet.SelectedValue.ToString()); break; case "staff": case "satpam": case "buruh": custid = int.Parse(rddCust.SelectedValue.ToString()); salesid = int.Parse(rddPelSales.SelectedValue.ToString()); break; case "contoh": break; case "rusak": break; case "return": //custtypeid and custtypetoid is switched break; } 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 , NBConfig.ValidUserName , StatusID, paid, 0).ToString(); } foreach (GridViewRowInfo item in radGridView1.Rows) { using (sinarekDataSetTableAdapters.logdetailTableAdapter tbl = new sinarekDataSetTableAdapters.logdetailTableAdapter()) { tbl.pInsertLogDetail(int.Parse(iLogID) , int.Parse(item.Cells["productid"].Value.ToString()) , decimal.Parse(item.Cells["quantity"].Value.ToString()) , -1 , 1 , 1 , NBConfig.ValidUserName); } } 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 = rddTipe.SelectedValue; 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("Surat Jalan ini dapat dilihat di daftar surat jalan yg belum di print."); } }