public String insert(BTax p, String userId) { String re = "", sql = ""; p.active = "1"; //p.ssdata_id = ""; chkNull(p); sql = "Insert Into " + btax.table + "(" + btax.b_tax_name_t + "," + btax.b_tax_code + "," + btax.rate1 + "," + btax.active + "," + btax.remark + ", " + btax.b_tax_name_e + ", " + btax.date_create + ", " + btax.date_modi + ", " + btax.date_cancel + ", " + btax.user_create + ", " + btax.user_modi + ", " + btax.user_cancel + "," + btax.rate1 + "," + btax.f_tax_type_id + " " + ") " + "Values ('" + p.b_tax_name_t.Replace("'", "''") + "','" + p.b_tax_code + "','" + p.rate1.Replace("'", "''") + "'," + "'" + p.active + "','" + p.remark.Replace("'", "''") + "','" + p.b_tax_name_e + "', " + "now(),'" + p.date_modi + "','" + p.date_cancel + "', " + "'" + userId + "','" + p.user_modi + "','" + p.user_cancel + "'," + "'" + p.rate1 + "','" + p.f_tax_type_id + "' " + ")"; try { re = conn.ExecuteNonQuery(conn.conn, sql); } catch (Exception ex) { sql = ex.Message + " " + ex.InnerException; } return(re); }
public C1ComboBox setC1CboItem(C1ComboBox c) { lexpn.Clear(); ComboBoxItem item = new ComboBoxItem(); DataTable dt = selectAll(); //String aaa = ""; ComboBoxItem item1 = new ComboBoxItem(); item1.Text = ""; item1.Value = "000"; c.Items.Clear(); c.Items.Add(item1); //for (int i = 0; i < dt.Rows.Count; i++) foreach (DataRow row in dt.Rows) { item = new ComboBoxItem(); item.Text = row[btax.b_tax_name_t].ToString(); item.Value = row[btax.b_tax_id].ToString(); c.Items.Add(item); BTax tax1 = new BTax(); tax1.b_tax_id = row[btax.b_tax_id].ToString(); tax1.b_tax_code = row[btax.b_tax_code].ToString(); tax1.b_tax_name_e = row[btax.b_tax_name_e].ToString(); tax1.b_tax_name_t = row[btax.b_tax_name_t].ToString(); lexpn.Add(tax1); } return(c); }
private void chkNull(BTax p) { int chk = 0; Decimal chk1 = 0; p.date_modi = p.date_modi == null ? "" : p.date_modi; p.date_cancel = p.date_cancel == null ? "" : p.date_cancel; p.user_create = p.user_create == null ? "" : p.user_create; p.user_modi = p.user_modi == null ? "" : p.user_modi; p.user_cancel = p.user_cancel == null ? "" : p.user_cancel; p.b_tax_name_t = p.b_tax_name_t == null ? "" : p.b_tax_name_t; p.rate1 = p.rate1 == null ? "0" : p.rate1; p.b_tax_code = p.b_tax_code == null ? "" : p.b_tax_code; p.remark = p.remark == null ? "" : p.remark; p.b_tax_name_e = p.b_tax_name_e == null ? "" : p.b_tax_name_e; //p.remark = p.remark == null ? "" : p.remark; p.f_tax_type_id = int.TryParse(p.f_tax_type_id, out chk) ? chk.ToString() : "0"; //p.payment_detail_id = int.TryParse(p.payment_detail_id, out chk) ? chk.ToString() : "0"; //p.job_id = int.TryParse(p.job_id, out chk) ? chk.ToString() : "0"; //p.tax_code = int.TryParse(p.tax_code, out chk) ? chk.ToString() : "0"; //p.comp_id = int.TryParse(p.comp_id, out chk) ? chk.ToString() : "0"; //p.tax_name_t = Decimal.TryParse(p.tax_name_t, out chk1) ? chk1.ToString() : "0"; //p.amount_income = Decimal.TryParse(p.amount_income, out chk1) ? chk1.ToString() : "0"; }
private void initConfig() { btax = new BTax(); btax.b_tax_id = "b_tax_id"; btax.b_tax_code = "b_tax_code"; btax.b_tax_name_t = "b_tax_name_t"; btax.b_tax_name_e = "b_tax_name_e"; //tax.payment_detail_id = "payment_detail_id"; //tax.job_id = "job_id"; btax.active = "active"; btax.remark = "remark"; btax.date_create = "date_create"; btax.date_modi = "date_modi"; btax.date_cancel = "date_cancel"; btax.user_create = "user_create"; btax.user_modi = "user_modi"; btax.user_cancel = "user_cancel"; btax.rate1 = "rate1"; btax.f_tax_type_id = "f_tax_type_id"; btax.table = "b_tax"; btax.pkField = "b_tax_id"; lexpn = new List <BTax>(); }
public String update(BTax p, String userId) { String re = "", sql = ""; chkNull(p); sql = "Update " + btax.table + " Set " + " " + btax.b_tax_name_t + "='" + p.b_tax_name_t.Replace("'", "''") + "' " + "," + btax.b_tax_name_e + "='" + p.b_tax_name_e.Replace("'", "''") + "' " + "," + btax.b_tax_id + "='" + p.b_tax_id.Replace("'", "''") + "' " + "," + btax.remark + "='" + p.remark.Replace("'", "''") + "' " + "," + btax.date_modi + "=now() " + "," + btax.user_modi + "='" + userId.Replace("'", "''") + "' " + "," + btax.b_tax_name_e + "='" + p.b_tax_name_e.Replace("'", "''") + "' " + "," + btax.b_tax_code + "='" + p.b_tax_code.Replace("'", "''") + "' " + "," + btax.rate1 + "='" + p.rate1.Replace("'", "''") + "' " + "," + btax.f_tax_type_id + "='" + p.f_tax_type_id.Replace("'", "''") + "' " + "Where " + btax.pkField + "='" + p.b_tax_id + "'"; try { re = conn.ExecuteNonQuery(conn.conn, sql); } catch (Exception ex) { sql = ex.Message + " " + ex.InnerException; } return(re); }
private void initConfig() { tax = new BTax(); fEdit = new Font(xC.iniC.grdViewFontName, xC.grdViewFontSize, FontStyle.Regular); fEditB = new Font(xC.iniC.grdViewFontName, xC.grdViewFontSize, FontStyle.Bold); C1ThemeController.ApplicationTheme = xC.iniC.themeApplication; theme1.Theme = C1ThemeController.ApplicationTheme; theme1.SetTheme(sB, "BeigeOne"); foreach (Control c in panel3.Controls) { theme1.SetTheme(c, "Office2013Red"); } bg = txtCode.BackColor; fc = txtCode.ForeColor; ff = txtCode.Font; txtPasswordVoid.KeyUp += TxtPasswordVoid_KeyUp; btnNew.Click += BtnNew_Click; btnEdit.Click += BtnEdit_Click; btnSave.Click += BtnSave_Click; xC.iniDB.fttDB.setC1CboFTax(cboFTax, ""); initGrfDept(); setGrfDeptH(); setControlEnable(false); setFocusColor(); sB1.Text = ""; btnVoid.Hide(); txtPasswordVoid.Hide(); stt = new C1SuperTooltip(); sep = new C1SuperErrorProvider(); //stt.BackgroundGradient = C1.Win.C1SuperTooltip.BackgroundGradient.Gold; }
private void setControl(String deptId) { tax = xC.iniDB.btaxDB.selectByPk1(deptId); txtID.Value = tax.b_tax_id; txtCode.Value = tax.b_tax_code; txtNameT.Value = tax.b_tax_name_t; txtRemark.Value = tax.remark; txtRate1.Value = tax.rate1; xC.setC1Combo(cboFTax, tax.f_tax_type_id); }
public BTax selectByPk1(String copId) { BTax cop1 = new BTax(); DataTable dt = new DataTable(); String sql = "select btax.* " + "From " + btax.table + " btax " + //"Left Join t_ssdata_visit ssv On ssv.ssdata_visit_id = bd.ssdata_visit_id " + "Where btax." + btax.pkField + " ='" + copId + "' "; dt = conn.selectData(conn.conn, sql); cop1 = setBTax(dt); return(cop1); }
public String insertBTax(BTax p, String userId) { String re = ""; if (p.b_tax_id.Equals("")) { re = insert(p, userId); } else { re = update(p, userId); } return(re); }
private void GrfTax_AfterEdit(object sender, RowColEventArgs e) { //throw new NotImplementedException(); if (e.Col == colTAmt) { Decimal amt = 0, amttax = 0, rate = 3; if (Decimal.TryParse(grfTax[e.Row, e.Col] != null ? grfTax[e.Row, e.Col].ToString() : "0", out amt)) { String item = "", bname = ""; item = grfTax[e.Row, colTItemNameT].ToString(); Items itm = new Items(); BTax btax = new BTax(); itm = xC.iniDB.itmDB.selectByNameT1(item); if (!itm.tax_id.Equals("")) { btax = xC.iniDB.btaxDB.selectByPk1(itm.tax_id); bname = btax.b_tax_name_t; if (!Decimal.TryParse(btax.rate1, out rate)) { MessageBox.Show("ไม่พบ อัตราภาษี", "Error"); return; } } else { MessageBox.Show("ไม่พบ ข้อมูลภาษี", "Error"); if (itm.tax_id.Equals("")) { return; } } grfTax[e.Row, colTtaxamt] = (amt * (rate / 100)); grfTax[e.Row, colTbtaxid] = itm.tax_id; grfTax[e.Row, colTbtaxnamet] = bname; if (grfTax.Rows.Count == e.Row + 1) { if (grfTax[e.Row, colTItemNameT] != null) { grfTax.Rows.Add(); } } } } }
public BTax setBTax(DataTable dt) { BTax tax1 = new BTax(); if (dt.Rows.Count > 0) { tax1.b_tax_id = dt.Rows[0][btax.b_tax_id].ToString(); tax1.b_tax_code = dt.Rows[0][btax.b_tax_code].ToString(); tax1.b_tax_name_t = dt.Rows[0][btax.b_tax_name_t].ToString(); tax1.b_tax_name_e = dt.Rows[0][btax.b_tax_name_e].ToString(); tax1.active = dt.Rows[0][btax.active].ToString(); tax1.date_cancel = dt.Rows[0][btax.date_cancel].ToString(); tax1.date_create = dt.Rows[0][btax.date_create].ToString(); tax1.date_modi = dt.Rows[0][btax.date_modi].ToString(); tax1.user_cancel = dt.Rows[0][btax.user_cancel].ToString(); tax1.user_create = dt.Rows[0][btax.user_create].ToString(); tax1.user_modi = dt.Rows[0][btax.user_modi].ToString(); tax1.remark = dt.Rows[0][btax.remark].ToString(); tax1.f_tax_type_id = dt.Rows[0][btax.f_tax_type_id].ToString(); tax1.rate1 = dt.Rows[0][btax.rate1].ToString(); } else { tax1.b_tax_id = ""; tax1.b_tax_code = ""; tax1.b_tax_name_t = ""; tax1.b_tax_name_e = ""; tax1.active = ""; tax1.remark = ""; tax1.date_create = ""; tax1.date_modi = ""; tax1.date_cancel = ""; tax1.user_create = ""; tax1.user_modi = ""; tax1.user_cancel = ""; tax1.rate1 = ""; tax1.f_tax_type_id = ""; } return(tax1); }
private void showGrfTaxView() { grfTaxView.Clear(); setGrfTaxView(); foreach (Row row in grfTax.Rows) { String btaxid = ""; Boolean chk = false; btaxid = row[colTbtaxid] != null ? row[colTbtaxid].ToString() : ""; if (btaxid.Equals("")) { continue; } foreach (Row rowT in grfTaxView.Rows) { String btaxidT = ""; btaxidT = rowT[colTbtaxid] != null ? rowT[colTbtaxid].ToString() : ""; if (btaxid.Equals(btaxidT)) { chk = true; } } if (!chk) { BTax btax = new BTax(); btax = xC.iniDB.btaxDB.selectByPk1(btaxid); Row rowA = grfTaxView.Rows.Add(); rowA[colTItemNameT] = btax.b_tax_name_t; rowA[colTtaxdate] = row[colTtaxdate]; rowA[colTbtaxid] = row[colTbtaxid]; rowA[colTftaxid] = btax.f_tax_type_id; } } foreach (Row rowT in grfTaxView.Rows) { String btaxidT = ""; Boolean chk = false; btaxidT = rowT[colTbtaxid] != null ? rowT[colTbtaxid].ToString() : ""; if (btaxidT.Equals("")) { continue; } Decimal amt = 0, tax = 0; foreach (Row row in grfTax.Rows) { String btaxid = ""; Decimal amt1 = 0, tax1 = 0; btaxid = row[colTbtaxid] != null ? row[colTbtaxid].ToString() : ""; if (btaxid.Equals(btaxidT)) { rowT[colTtaxdate] = row[colTtaxdate]; if (Decimal.TryParse(row[colTAmt] != null ? row[colTAmt].ToString() : "0", out amt1)) { amt += amt1; } if (Decimal.TryParse(row[colTtaxamt] != null ? row[colTtaxamt].ToString() : "0", out tax1)) { tax += tax1; } } } rowT[colTAmt] = amt; rowT[colTtaxamt] = tax; } grfTaxView.Show(); grfTax.Hide(); }