private void AutoID() { DateTime TglKontrak = Convert.ToDateTime(tglKontrak.Text); string[] j = (Cf.DaySlash1(tglKontrak.Text)).ToString().Split('/'); string Tahunkontrak = j[2]; string Tower = Db.SingleString("select Lokasi from ms_unit where nostock = '" + NoStock + "'"); int c = Db.SingleInteger("SELECT COUNT(NoKontrak) FROM MS_KONTRAK"); bool hasfound = false; while (!hasfound) { if (!Response.IsClientConnected) { break; } c++; nokontrak.Text = "SPU/" + Tower + "/" + Tahunkontrak + "/" + Cf.Roman(Convert.ToDateTime(tglKontrak.Text).Month) + "/" + c.ToString().PadLeft(5, '0'); if (isUnique()) { hasfound = true; } } }
private string AutoID() { string x = ""; int c = Db.SingleInteger("SELECT COUNT(NoPPJB) FROM MS_KONTRAK " + " WHERE PPJB = 'D'" ); bool hasfound = false; while (!hasfound) { if (!Response.IsClientConnected) { break; } c++; x = c.ToString().PadLeft(5, '0'); if (isUnique(x)) { x = x + "/SP/PPJB/" + Cf.Roman(DateTime.Now.Month) + "/" + DateTime.Now.Year; hasfound = true; } } return(x); }
protected void Page_Load(object sender, EventArgs e) { DataTable rs = Db.Rs("SELECT * FROM MS_TTS WHERE NOBKM!=''"); for (int i = 0; i < rs.Rows.Count; i++) { //DateTime TglTTS = Convert.ToDateTime(rs.Rows[i]["TglTTS"]); //string noTTS = rs.Rows[i]["NoTTS"].ToString(); //string formatMonth = Cf.Roman(TglTTS.Month); //string formatTahun = TglTTS.Year.ToString().Substring(2, 2); //string NoTTS2 = ""; // int num = Db.SingleInteger("SELECT COUNT(NoTTS2) FROM MS_TTS WHERE MONTH(TglTTS)='" + TglTTS.Month + "' AND YEAR(TglTTS)='" + TglTTS.Year + "' and NoTTS2!=''"); // int increment = num + 1; // string no = increment.ToString().PadLeft(7, '0'); // NoTTS2 = "TTS/" + formatTahun + "/" + formatMonth + "/" + no; //Db.Execute("UPDATE MS_TTS SET NoTTS2 = '" + NoTTS2 + "' WHERE NoTTS ='" + noTTS + "'"); //Db.Execute("UPDATE ISC064_MARKETINGJUAL..MS_PELUNASAN SET NoTTS2='" + NoTTS2 + "' WHERE NoTTS ='" + noTTS + "'"); DateTime TglBKM = Convert.ToDateTime(rs.Rows[i]["TglBKM"]); string noTTS = rs.Rows[i]["NoTTS"].ToString(); string formatMonth = Cf.Roman(TglBKM.Month); string formatTahun = TglBKM.Year.ToString().Substring(2, 2); string NoBKM2 = ""; int num = Db.SingleInteger("SELECT COUNT(NoBKM2) FROM MS_TTS WHERE Status='POST' AND MONTH(TglBKM)='" + TglBKM.Month + "' AND YEAR(TglBKM)='" + TglBKM.Year + "' AND NOBKM != ''"); //BKM Pertama int increment = num + 1; string no = increment.ToString().PadLeft(7, '0'); NoBKM2 = "KW/" + formatTahun + "/" + formatMonth + "/" + no; Db.Execute("UPDATE MS_TTS SET NoBKM2 = '" + NoBKM2 + "' WHERE NoTTS ='" + noTTS + "'"); Db.Execute("UPDATE ISC064_MARKETINGJUAL..MS_PELUNASAN SET NoBKM2='" + NoBKM2 + "' WHERE NoTTS ='" + noTTS + "'"); Response.Write("a"); } }
private string AutoID(DateTime TglPPJB) { string x = ""; int c = Db.SingleInteger("SELECT COUNT(NoPPJB) FROM MS_KONTRAK " + " WHERE PPJB = 'D'" ); int d = Db.SingleInteger("SELECT COUNT(NoPPJB) FROM MS_KONTRAK " + " WHERE PPJB = 'D' AND MONTH(TglPPJB)='" + TglPPJB.Month + "' AND YEAR(TglPPJB)='" + TglPPJB.Year + "'" ); bool hasfound = false; while (!hasfound) { if (!Response.IsClientConnected) { break; } c++; d++; x = c.ToString().PadLeft(4, '0') + "/DU/" + Act.UserID + "/AMT/PPJB." + d.ToString() + "/" + Cf.Roman(TglPPJB.Month) + "/" + TglPPJB.Year.ToString(); if (isUnique(x)) { hasfound = true; } } return(x); }
protected void Header() { header.Text = Mi.Pt + "<br />" + "LAPORAN CASH FLOW" ; System.Text.StringBuilder x = new System.Text.StringBuilder(); Dari = Convert.ToInt32(dari.SelectedValue); // Sampai = Convert.ToInt32(sampai.SelectedValue); // if(Dari > Sampai) // { int y = Dari; // Dari = Sampai; // Sampai = y; // } x.Append("Periode: " + thn.SelectedValue); TableRow r; TableCell c; TableHeaderCell hc; // r = new TableRow(); // c = new TableCell(); // c.ColumnSpan = Dari - 5; // c.Attributes["style"] = "font-size: 8pt;"; // r.Cells.Add(c); // // rpt.Rows.Add(r); r = new TableRow(); hc = new TableHeaderCell(); hc.Text = "No. Kontrak"; hc.Attributes["style"] = "background-color: gray; color: white;"; hc.RowSpan = 2; hc.Width = 100; r.Cells.Add(hc); hc = new TableHeaderCell(); hc.Text = "Status"; hc.Attributes["style"] = "background-color: gray; color: white;"; hc.RowSpan = 2; r.Cells.Add(hc); hc = new TableHeaderCell(); hc.Text = "Customer"; hc.Attributes["style"] = "background-color: gray; color: white;"; hc.RowSpan = 2; hc.Width = 200; r.Cells.Add(hc); hc = new TableHeaderCell(); hc.Text = "Unit"; hc.Attributes["style"] = "background-color: gray; color: white;"; hc.RowSpan = 2; r.Cells.Add(hc); int j = Dari; // for(int i = Dari; i <= Sampai; i++) // { hc = new TableHeaderCell(); hc.Text = Cf.Monthname(j); hc.Attributes["style"] = "background-color: gray; color: white;"; hc.ColumnSpan = 4; r.Cells.Add(hc); // } rpt.Rows.Add(r); r = new TableRow(); int roman = 1; int temp = 1; for (int i = 0; i < temp * 4; i++) { hc = new TableHeaderCell(); hc.Text = Cf.Roman(roman); hc.Attributes["style"] = "background-color: gray; color: white;"; r.Cells.Add(hc); roman++; if (roman > 4) { roman = 1; } } rpt.Rows.Add(r); }
protected void save_Click(object sender, System.EventArgs e) { if (datavalid()) { for (int i = 0; i < rsTagihan.Rows.Count; i++) { TextBox lunas = (TextBox)ph.FindControl("lunas_" + i); TextBox va = (TextBox)ph.FindControl("va_" + i); TextBox tgl = (TextBox)ph.FindControl("tgl_" + i); TextBox nokontrak = (TextBox)ph.FindControl("ref_" + i); TextBox cs = (TextBox)ph.FindControl("cs_" + i); TextBox unit = (TextBox)ph.FindControl("unit_" + i); TextBox tag = (TextBox)ph.FindControl("tag_" + i); //int z = Db.SingleInteger("SELECT COUNT(NoBKM) FROM MS_TTS WHERE NoBKM != '' AND YEAR(TglBKM) = " + Convert.ToDateTime(tgl.Text).Year); string c1 = Db.SingleString("SELECT TOP 1 SUBSTRING(NoBKM,5,6) FROM MS_TTS ORDER BY NoBKM DESC"); int z = Convert.ToInt32(c1); string nobkm = ""; bool hasfound = false; while (!hasfound) { if (!Response.IsClientConnected) { break; } z += 1; //nopjt = c.ToString() + "/" + u + "/" + Convert.ToDateTime(tgl.Text).Year; nobkm = "DMC/" + z.ToString().PadLeft(6, '0') + "/" + Cf.Roman(Convert.ToDateTime(tgl.Text).Month) + "/" + Convert.ToDateTime(tgl.Text).Year + "/RC"; if (isUnique(nobkm)) { hasfound = true; } } string NoBKM2 = nobkm; if (lunas.Text != "") { Db.Execute("EXEC spTTSRegistrasi" + " '" + Convert.ToDateTime(tgl.Text) + "'" + ",'" + Act.UserID + "'" + ",'" + Act.IP + "'" + ",'JUAL'" + ",'" + Cf.Str(nokontrak.Text) + "'" + ",'" + Cf.Str(unit.Text) + "'" + ",'" + Cf.Str(cs.Text) + "'" + ",'TR'" + ",'VA: " + Cf.Str(va.Text) + "'" ); int NoTTS = Db.SingleInteger("SELECT TOP 1 NoTTS FROM MS_TTS ORDER BY NoTTS DESC"); Db.Execute("UPDATE MS_TTS" + " SET Acc = '" + Bank + "'" + " WHERE NoTTS = " + NoTTS ); string[] arr = tag.Text.Split(';'); Db.Execute("EXEC spTTSAlokasi " + " " + NoTTS + ", " + arr[0] + ", " + Convert.ToDecimal(lunas.Text) ); Db.Execute("EXEC spPostingTTS " + NoTTS + ", '" + NoBKM2 + "', '" + Convert.ToDateTime(tgl.Text) + "'"); Db.Execute("UPDATE MS_TTS" + " SET ManualBKM = ManualTTS" + ", TanggalUangDiterima = TglBKM" + " WHERE NoTTS = " + NoTTS); //Ambil Stok No. FP DataTable fp = Db.Rs("SELECT * FROM REF_FP WHERE Status = 0"); if (fp.Rows.Count > 0) { Db.Execute("UPDATE MS_TTS SET" + " NoFPS = '" + fp.Rows[0]["NoFPS"].ToString() + "'" + " WHERE NoTTS = " + NoTTS); Db.Execute("UPDATE REF_FP SET" + " Status = 1" + " WHERE NoFPS = '" + fp.Rows[0]["NoFPS"].ToString() + "'"); } string NoBKM3 = Db.SingleString("SELECT NoBKM FROM MS_TTS WHERE NoTTS = " + NoTTS); DataTable rsLog = Db.Rs("SELECT " + " CONVERT(varchar, TglTTS, 106) AS [Tanggal]" + ",Tipe" + ",Ref AS [Ref.]" + ",Unit" + ",Customer" + ",CaraBayar AS [Cara Bayar]" + ",Ket AS [Keterangan]" + ",Total" + ",NoBG AS [No. BG]" + ",CONVERT(varchar, TglBG, 106) AS [Tanggal BG]" + ", Acc AS [Rekening Bank]" + " FROM MS_TTS WHERE NoTTS = " + NoTTS); string KetLog = Cf.LogCapture(rsLog) + "<br>***ALOKASI PEMBAYARAN:<br>" + arr[1] + " (" + arr[2] + ")"; Db.Execute("EXEC spLogTTS" + " 'VA'" + ",'" + Act.UserID + "'" + ",'" + Act.IP + "'" + ",'" + KetLog + "'" + ",'" + NoTTS.ToString().PadLeft(7, '0') + "'" ); decimal LogID = Db.SingleDecimal("SELECT TOP 1 LogID FROM MS_TTS_LOG ORDER BY LogID DESC"); string Project = Db.SingleString("SELECT Project FROM " + Mi.DbPrefix + "MARKETINGJUAL..MS_KONTRAK WHERE NoKontrak = (SELECT Ref FROM MS_TTS WHERE NoTTS = '" + NoTTS + "')"); Db.Execute("UPDATE MS_TTS_LOG SET Project = '" + Project + "' WHERE LogID = " + LogID); // Db.Execute("EXEC " + Mi.DbPrefix + "MARKETINGJUAL..spDenda"); //Result TableRow r = new TableRow(); TableCell c; c = new TableCell(); c.Text = va.Text; r.Cells.Add(c); c = new TableCell(); c.Text = Cf.Day(tgl.Text); r.Cells.Add(c); c = new TableCell(); c.Text = "<a href=\"javascript:call('" + NoTTS + "')\">" + NoTTS.ToString().PadLeft(7, '0') + "</a>" + "<br /><i>POST</i>" + "<br />BKM: " + NoBKM3; r.Cells.Add(c); c = new TableCell(); c.Text = "JUAL No. " + nokontrak.Text + "<br />" + unit.Text + "<br />" + cs.Text; r.Cells.Add(c); c = new TableCell(); c.Text = Cf.Num(lunas.Text); c.HorizontalAlign = HorizontalAlign.Right; r.Cells.Add(c); Rpt.Border(r); rpt.Rows.Add(r); } } div1.Visible = false; div2.Visible = true; feed.Text = "<img src='/Media/db.gif' align=absmiddle> " + "Upload Success.." ; Dfc.DeleteFile(FilePath); } }
protected void save_Click(object sender, System.EventArgs e) { if (datavalid()) { for (int j = 0; j < baris; j++) { TextBox va = (TextBox)ph.FindControl("va_" + j); TextBox tgl = (TextBox)ph.FindControl("tgl_" + j); TextBox nokontrak = (TextBox)ph.FindControl("ref_" + j); TextBox cs = (TextBox)ph.FindControl("cs_" + j); TextBox unit = (TextBox)ph.FindControl("unit_" + j); TextBox ket = (TextBox)ph.FindControl("ket_" + j); DateTime TglBKM = Convert.ToDateTime(tgl.Text); DateTime TglTTS = Convert.ToDateTime(tgl.Text); string KetTag = ""; # region NoTTS yg pake format //NoTTS string formatMonth = Cf.Roman(TglTTS.Month); string formatTahun = TglTTS.Year.ToString().Substring(2, 2); string NoTTS2 = ""; bool hasfound = false; while (!hasfound) { if (!Response.IsClientConnected) { break; } int num = Db.SingleInteger("SELECT COUNT(NoTTS2) FROM MS_TTS WHERE MONTH(TglTTS)='" + TglTTS.Month + "' AND YEAR(TglTTS)='" + TglTTS.Year + "'"); if (num == 0) { //TTS Pertama int increment = num + 1; string no = increment.ToString().PadLeft(7, '0'); NoTTS2 = "TTS/" + formatTahun + "/" + formatMonth + "/" + no; } else { //TTS Berikutnya string terakhir = Db.SingleString("SELECT TOP 1 NoTTS2 FROM MS_TTS WHERE MONTH(TglTTS)='" + TglTTS.Month + "' AND YEAR(TglTTS)='" + TglTTS.Year + "' ORDER BY NoTTS2 DESC"); string temp = terakhir.Substring(terakhir.Length - 7); int temp2 = Convert.ToInt32(temp) + 1; string no = temp2.ToString().PadLeft(7, '0'); NoTTS2 = "TTS/" + formatTahun + "/" + formatMonth + "/" + no; } if (isUniqueTTS(NoTTS2)) { hasfound = true; } } #endregion Db.Execute("EXEC spTTSRegistrasi" + " '" + Convert.ToDateTime(tgl.Text) + "'" + ",'" + Act.UserID + "'" + ",'" + Act.IP + "'" + ",'JUAL'" + ",'" + nokontrak.Text + "'" + ",'" + unit.Text + "'" + ",'" + cs.Text + "'" + ",'TR'" + ",'VA: " + Cf.Str(va.Text) + " " + ket.Text + "'" ); string[] x = Cf.SplitByString(Bank, ";"); int NoTTS = Db.SingleInteger("SELECT TOP 1 NoTTS FROM MS_TTS ORDER BY NoTTS DESC"); Db.Execute("UPDATE MS_TTS" + " SET Acc = '" + x[0] + "'" + ", SubID='" + x[1] + "'" + " WHERE NoTTS = '" + NoTTS + "'" ); for (int i = 0; i < rsTagihan.Rows.Count; i++) { TextBox lunas = (TextBox)ph.FindControl("lunas_" + j + "_" + i); TextBox tag = (TextBox)ph.FindControl("tag_" + j + "_" + i); if (lunas != null && tag != null && lunas.Text != "") { string[] arr = tag.Text.Split(';'); Db.Execute("EXEC spTTSAlokasi " + " '" + NoTTS + "'" + ", " + arr[0] + ", " + Convert.ToDecimal(lunas.Text) ); KetTag = "<br>***ALOKASI PEMBAYARAN:<br>" + arr[1] + " (" + arr[2] + ")"; } } //========================================== //Update NoBKM di MS_TTS # region no bkm2 //NoBK string formatMonth2 = Cf.Roman(TglBKM.Month); string formatTahun2 = TglBKM.Year.ToString().Substring(2, 2); string NoBKM2 = ""; bool hasfound2 = false; while (!hasfound2) { if (!Response.IsClientConnected) { break; } int num = Db.SingleInteger("SELECT COUNT(NoBKM2) FROM MS_TTS WHERE Status='POST' AND MONTH(TglBKM)='" + TglBKM.Month + "' AND YEAR(TglBKM)='" + TglBKM.Year + "'"); if (num == 0) { //BKM Pertama int increment = num + 1; string no = increment.ToString().PadLeft(7, '0'); NoBKM2 = "KW/" + formatTahun2 + "/" + formatMonth2 + "/" + no; } else { //NoBKM Terakhir string terakhir = Db.SingleString("SELECT TOP 1 NoBKM2 FROM MS_TTS WHERE Status='POST' AND MONTH(TglBKM)='" + TglBKM.Month + "' AND YEAR(TglBKM)='" + TglBKM.Year + "' ORDER BY NoBKM2 DESC"); string temp = terakhir.Substring(terakhir.Length - 7); int temp2 = Convert.ToInt32(temp) + 1; string no = temp2.ToString().PadLeft(7, '0'); NoBKM2 = "KW/" + formatTahun2 + "/" + formatMonth2 + "/" + no; } if (isUniqueBKM(NoBKM2)) { hasfound2 = true; } } #endregion //======================================= Db.Execute("EXEC spPostingTTS " + NoTTS + ",'" + TglBKM + "'"); Db.Execute("UPDATE MS_TTS SET ManualBKM = ManualTTS, NoBKM2='" + NoBKM2 + "', TglFP = '" + TglBKM + "', NoTTS2='" + NoTTS2 + "' WHERE NoTTS = " + NoTTS); Db.Execute("UPDATE ISC064_MARKETINGJUAL..MS_PELUNASAN SET NoBKM2='" + NoBKM2 + "' WHERE NoTTS = " + NoTTS); DataTable rsLog = Db.Rs("SELECT " + " CONVERT(varchar, TglTTS, 106) AS [Tanggal]" + ",Tipe" + ",Ref AS [Ref.]" + ",Unit" + ",Customer" + ",CaraBayar AS [Cara Bayar]" + ",Ket AS [Keterangan]" + ",Total" + ",NoBG AS [No. BG]" + ",CONVERT(varchar, TglBG, 106) AS [Tanggal BG]" + ", Acc AS [Rekening Bank]" + " FROM MS_TTS WHERE NoTTS = '" + NoTTS + "'"); string KetLog = Cf.LogCapture(rsLog) + KetTag; Db.Execute("EXEC spLogTTS" + " 'VA'" + ",'" + Act.UserID + "'" + ",'" + Act.IP + "'" + ",'" + KetLog + "'" + ",'" + NoTTS + "'" ); decimal LogID = Db.SingleDecimal("SELECT TOP 1 LogID FROM MS_TTS_LOG ORDER BY LogID DESC"); string Project = Db.SingleString("SELECT Project FROM " + Mi.DbPrefix + "MARKETINGJUAL..MS_KONTRAK WHERE NoKontrak = (SELECT Ref FROM MS_TTS WHERE NoTTS = '" + NoTTS + "')"); Db.Execute("UPDATE MS_TTS_LOG SET Project = '" + Project + "' WHERE LogID = " + LogID); //Result TableRow r = new TableRow(); TableCell c; c = new TableCell(); c.Text = va.Text; r.Cells.Add(c); c = new TableCell(); c.Text = Cf.Day(tgl.Text); r.Cells.Add(c); c = new TableCell(); c.Text = "<a href=\"javascript:call('" + NoTTS + "')\">" + NoTTS2 + "</a>" + "<br /><i>POST</i>" + "<br />BKM: " + NoBKM2; r.Cells.Add(c); c = new TableCell(); c.Text = "JUAL No. " + nokontrak.Text + "<br />" + unit.Text + "<br />" + cs.Text; r.Cells.Add(c); c = new TableCell(); c.Text = Cf.Num(Db.SingleDecimal("SELECT ISNULL(Total,0) FROM MS_TTS WHERE NoTTS=" + NoTTS + " AND Ref='" + nokontrak.Text + "'")); c.HorizontalAlign = HorizontalAlign.Right; r.Cells.Add(c); Rpt.Border(r); rpt.Rows.Add(r); }