private void initConfig() { itmtS = new ItemsTypeSub(); itmtS.item_type_sub_id = "item_type_sub_id"; itmtS.item_type_id = "item_type_id"; itmtS.item_type_sub_code = "item_type_sub_code"; itmtS.item_type_sub_name_t = "item_type_sub_name_t"; itmtS.item_type_sub_name_e = "item_type_sub_name_e"; itmtS.active = "active"; itmtS.remark = "remark"; itmtS.date_create = "date_create"; itmtS.date_modi = "date_modi"; itmtS.date_cancel = "date_cancel"; itmtS.user_create = "user_create"; itmtS.user_modi = "user_modi"; itmtS.user_cancel = "user_cancel"; itmtS.f_method_payment_id = "f_method_payment_id"; itmtS.status_invoice = "status_invoice"; itmtS.status_tax53 = "status_tax53"; itmtS.acc_code = "acc_code"; itmtS.sort1 = "sort1"; itmtS.status_item_edit = "status_item_edit"; itmtS.tax_id = "tax_id"; itmtS.status_hide = "status_hide"; itmtS.table = "b_items_type_sub"; itmtS.pkField = "item_type_sub_id"; litmtS = new List <ItemsTypeSub>(); }
private void setControl(String deptId) { itmtS = xC.iniDB.itmtsDB.selectByPk1(deptId); txtID.Value = itmtS.item_type_sub_id; txtCode.Value = itmtS.item_type_sub_code; txtNameT.Value = itmtS.item_type_sub_name_t; txtRemark.Value = itmtS.remark; xC.setC1Combo(cboItmT, itmtS.item_type_id); xC.setC1Combo(cboFMtp, itmtS.f_method_payment_id); cboTax.SelectedIndex = 0; xC.setC1Combo(cboTax, itmtS.tax_id); chkItmEdit.Checked = itmtS.status_item_edit.Equals("1") ? true : false; chkInv.Checked = itmtS.status_invoice.Equals("1") ? true : false; chkTax53.Checked = itmtS.status_tax53.Equals("1") ? true : false; chkStatusServ.Checked = itmtS.status_hide.Equals("1") ? true : false; txtAccCode.Value = itmtS.acc_code; if (chkTax53.Checked) { cboTax.Show(); } else { cboTax.Hide(); } }
private void chkNull(ItemsTypeSub 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.item_type_sub_code = p.item_type_sub_code == null ? "" : p.item_type_sub_code; p.item_type_sub_name_t = p.item_type_sub_name_t == null ? "" : p.item_type_sub_name_t; p.item_type_sub_name_e = p.item_type_sub_name_e == null ? "" : p.item_type_sub_name_e; p.remark = p.remark == null ? "" : p.remark; p.sort1 = p.sort1 == null ? "" : p.sort1; p.acc_code = p.acc_code == null ? "" : p.acc_code; p.status_invoice = p.status_invoice == null ? "0" : p.status_invoice; p.status_tax53 = p.status_tax53 == null ? "0" : p.status_tax53; p.status_item_edit = p.status_item_edit == null ? "0" : p.status_item_edit; p.status_hide = p.status_hide == null ? "0" : p.status_hide; p.item_type_id = int.TryParse(p.item_type_id, out chk) ? chk.ToString() : "0"; p.f_method_payment_id = int.TryParse(p.f_method_payment_id, out chk) ? chk.ToString() : "0"; p.tax_id = int.TryParse(p.tax_id, out chk) ? chk.ToString() : "0"; }
private void CboItmts_SelectedItemChanged(object sender, EventArgs e) { //throw new NotImplementedException(); String itmts1 = ""; itmts1 = cboItmts.SelectedItem != null ? ((ComboBoxItem)(cboItmts.SelectedItem)).Value : ""; if (itmts1.Equals("")) { return; } ItemsTypeSub itmts = new ItemsTypeSub(); itmts = xC.iniDB.itmtsDB.selectByPk1(itmts1); if (itmts.status_item_edit.Equals("1")) { gBTypeSub.Enabled = true; } else { gBTypeSub.Enabled = false; } txtAccCode.Value = itmts.acc_code; chkVat.Checked = itmts.status_invoice.Equals("1") ? true : false; chkTax53.Checked = itmts.status_tax53.Equals("1") ? true : false; chkStatusServ.Checked = itmts.status_hide.Equals("1") ? true : false; xC.setC1Combo(cboFMtp, itmts.f_method_payment_id); }
private void setItem() { itm.item_id = txtID.Text; itm.item_code = txtCode.Text; itm.item_name_t = txtNameT.Text; itm.remark = txtRemark.Text; itm.item_type_sub_id = cboItmts.SelectedItem != null ? ((ComboBoxItem)(cboItmts.SelectedItem)).Value : ""; itm.item_cat_id = cboItmC.SelectedItem != null ? ((ComboBoxItem)(cboItmC.SelectedItem)).Value : ""; itm.item_grp_id = cboItmG.SelectedItem != null ? ((ComboBoxItem)(cboItmG.SelectedItem)).Value : ""; itm.status_invoice = chkVat.Checked ? "1" : "0"; itm.status_tax53 = chkTax53.Checked ? "1" : "0"; itm.acc_code = txtAccCode.Text; itm.f_method_payment_id = cboFMtp.SelectedItem != null ? ((ComboBoxItem)(cboFMtp.SelectedItem)).Value : ""; itm.price1 = txtPrice1.Text; itm.price2 = txtPrice2.Text; itm.price3 = txtPrice3.Text; itm.price4 = txtPrice4.Text; itm.price5 = txtPrice5.Text; itm.unit_id = cboUtp.SelectedItem != null ? ((ComboBoxItem)(cboUtp.SelectedItem)).Value : ""; itm.item_group_id = txtItmGroupId.Text; if (itm.item_group_id.Equals("")) { ItemsTypeSub itmts = new ItemsTypeSub(); ItemsType itmt = new ItemsType(); itmts = xC.iniDB.itmtsDB.selectByPk1(itm.item_type_sub_id); itmt = xC.iniDB.itmtDB.selectByPk1(itmts.item_type_id); itm.item_group_id = itmt.item_group_id; } itm.tax_id = cboTax.SelectedItem != null ? ((ComboBoxItem)(cboTax.SelectedItem)).Value : ""; itm.status_hide = chkStatusServ.Checked ? "1" : "0"; }
public ItemsTypeSub setItemsTypeSub(DataTable dt) { ItemsTypeSub curr1 = new ItemsTypeSub(); if (dt.Rows.Count > 0) { curr1.item_type_sub_id = dt.Rows[0][itmtS.item_type_sub_id].ToString(); curr1.item_type_id = dt.Rows[0][itmtS.item_type_id].ToString(); curr1.item_type_sub_code = dt.Rows[0][itmtS.item_type_sub_code].ToString(); curr1.item_type_sub_name_t = dt.Rows[0][itmtS.item_type_sub_name_t].ToString(); curr1.active = dt.Rows[0][itmtS.active].ToString(); curr1.date_cancel = dt.Rows[0][itmtS.date_cancel].ToString(); curr1.date_create = dt.Rows[0][itmtS.date_create].ToString(); curr1.date_modi = dt.Rows[0][itmtS.date_modi].ToString(); curr1.user_cancel = dt.Rows[0][itmtS.user_cancel].ToString(); curr1.user_create = dt.Rows[0][itmtS.user_create].ToString(); curr1.user_modi = dt.Rows[0][itmtS.user_modi].ToString(); curr1.item_type_sub_name_e = dt.Rows[0][itmtS.item_type_sub_name_e].ToString(); curr1.remark = dt.Rows[0][itmtS.remark].ToString(); curr1.sort1 = dt.Rows[0][itmtS.sort1].ToString(); curr1.f_method_payment_id = dt.Rows[0][itmtS.f_method_payment_id].ToString(); curr1.status_invoice = dt.Rows[0][itmtS.status_invoice].ToString(); curr1.status_tax53 = dt.Rows[0][itmtS.status_tax53].ToString(); curr1.acc_code = dt.Rows[0][itmtS.acc_code].ToString(); curr1.status_item_edit = dt.Rows[0][itmtS.status_item_edit].ToString(); curr1.tax_id = dt.Rows[0][itmtS.tax_id].ToString(); curr1.status_hide = dt.Rows[0][itmtS.status_hide].ToString(); } else { curr1.item_type_sub_id = ""; curr1.item_type_id = ""; curr1.item_type_sub_code = ""; curr1.item_type_sub_name_t = ""; curr1.item_type_sub_name_e = ""; curr1.active = ""; curr1.remark = ""; curr1.date_create = ""; curr1.date_modi = ""; curr1.date_cancel = ""; curr1.user_create = ""; curr1.user_modi = ""; curr1.user_cancel = ""; curr1.f_method_payment_id = ""; curr1.status_invoice = ""; curr1.status_tax53 = ""; curr1.acc_code = ""; curr1.sort1 = ""; curr1.status_item_edit = ""; curr1.tax_id = ""; curr1.status_hide = ""; } return(curr1); }
private void setControl(String deptId) { itm = xC.iniDB.itmDB.selectByPk1(deptId); txtID.Value = itm.item_id; txtItmGroupId.Value = itm.item_group_id; txtCode.Value = itm.item_code; txtNameT.Value = itm.item_name_t; txtRemark.Value = itm.remark; xC.setC1Combo(cboItmC, itm.item_cat_id); xC.setC1Combo(cboItmG, itm.item_grp_id); xC.setC1Combo(cboItmts, itm.item_type_sub_id); xC.setC1Combo(cboFMtp, itm.f_method_payment_id); xC.setC1Combo(cboUtp, itm.unit_id); cboTax.SelectedIndex = 0; xC.setC1Combo(cboTax, itm.tax_id); txtAccCode.Value = itm.acc_code; chkVat.Checked = itm.status_invoice.Equals("1") ? true : false; chkTax53.Checked = itm.status_tax53.Equals("1") ? true : false; chkStatusServ.Checked = itm.status_hide.Equals("1") ? true : false; if (chkTax53.Checked) { cboTax.Show(); } else { cboTax.Hide(); } ItemsTypeSub itmts = new ItemsTypeSub(); itmts = xC.iniDB.itmtsDB.selectByPk1(itm.item_type_sub_id); if (itmts.status_item_edit.Equals("1")) { gBTypeSub.Enabled = true; } else { gBTypeSub.Enabled = false; } if (itm.tax_id.Equals("0") || itm.tax_id.Equals("")) { if (!itmts.tax_id.Equals("")) { itm.tax_id = itmts.tax_id; } xC.setC1Combo(cboTax, itm.tax_id); } txtPrice1.Value = itm.price1; txtPrice2.Value = itm.price2; txtPrice3.Value = itm.price3; txtPrice4.Value = itm.price4; txtPrice5.Value = itm.price5; }
public ItemsTypeSub selectByPk1(String copId) { ItemsTypeSub cop1 = new ItemsTypeSub(); DataTable dt = new DataTable(); String sql = "select itmtS.* " + "From " + itmtS.table + " itmtS " + //"Left Join t_ssdata_visit ssv On ssv.ssdata_visit_id = bd.ssdata_visit_id " + "Where itmtS." + itmtS.pkField + " ='" + copId + "' "; dt = conn.selectData(conn.conn, sql); cop1 = setItemsTypeSub(dt); return(cop1); }
public String insertItemsTypeSub(ItemsTypeSub p, String userId) { String re = ""; if (p.item_type_sub_id.Equals("")) { re = insert(p, userId); } else { re = update(p, userId); } return(re); }
public void getlexpnC() { litmtS = new List <ItemsTypeSub>(); DataTable dt = new DataTable(); dt = selectAll(); foreach (DataRow row in dt.Rows) { ItemsTypeSub curr1 = new ItemsTypeSub(); curr1.item_type_sub_id = row[itmtS.item_type_sub_id].ToString(); curr1.item_type_sub_code = row[itmtS.item_type_sub_code].ToString(); curr1.item_type_sub_name_e = row[itmtS.item_type_sub_name_e].ToString(); curr1.item_type_sub_name_t = row[itmtS.item_type_sub_name_t].ToString(); litmtS.Add(curr1); } }
private void BtnCashOk_Click(object sender, EventArgs e) { //throw new NotImplementedException(); grfBill.Clear(); grfBill.Rows.Count = 1; grfBill.Cols[colBItmNameT].Width = 220; grfBill.Cols[colBExpn].Width = 100; grfBill.Cols[colBimcome].Width = 100; //grfBill.Cols[colCDrawDate].Width = 100; //grfBill.Cols[colCAmt].Width = 100; grfBill.Cols[colBItmNameT].Caption = "รายการ"; grfBill.Cols[colBExpn].Caption = "ค่าใช้จ่าย"; grfBill.Cols[colBimcome].Caption = "รายได้"; grfBill.Cols[colBID].Visible = false; foreach (Row rowD in grfDraw.Rows) { if (rowD[colCChk] == null) { continue; } if ((Boolean)rowD[colCChk]) { String ddid = ""; ExpensesDrawDatail expndd = new ExpensesDrawDatail(); Items itm = new Items(); ItemsType itmt = new ItemsType(); ItemsTypeSub itmts = new ItemsTypeSub(); ddid = rowD[colCID].ToString(); expndd = xC.accDB.expnddDB.selectByPk1(ddid); itm = xC.iniDB.itmDB.selectByPk1(expndd.item_id); if (itm.item_group_id.Equals("")) { itmts = xC.iniDB.itmtsDB.selectByPk1(itm.item_type_sub_id); itmt = xC.iniDB.itmtDB.selectByPk1(itmts.item_type_id); itm.item_group_id = itmt.item_group_id; } itm.item_name_t = rowD[colCItmNameT].ToString(); itm.amt = rowD[colCAmt].ToString(); itm.cust_id = expndd.expenses_draw_detail_id; //ฝาก setRowGrfBill(itm); } } calAmtGrfBill(); tC2.SelectedTab = tabBill; }
public String insert(ItemsTypeSub p, String userId) { String re = ""; String sql = ""; p.active = "1"; //p.ssdata_id = ""; int chk = 0; chkNull(p); //p.prefix_id = int.TryParse(p.prefix_id, out chk) ? chk.ToString() : "0"; //p.dept_id = int.TryParse(p.dept_id, out chk) ? chk.ToString() : "0"; sql = "Insert Into " + itmtS.table + "(" + itmtS.item_type_id + "," + itmtS.item_type_sub_code + "," + itmtS.item_type_sub_name_t + "," + itmtS.date_create + "," + itmtS.date_modi + "," + itmtS.date_cancel + "," + itmtS.user_create + "," + itmtS.user_modi + "," + itmtS.user_cancel + "," + itmtS.active + "," + itmtS.remark + ", " + itmtS.sort1 + ", " + itmtS.item_type_sub_name_e + "," + itmtS.f_method_payment_id + ", " + itmtS.status_invoice + ", " + itmtS.status_tax53 + "," + itmtS.acc_code + "," + itmtS.status_item_edit + "," + itmtS.tax_id + "," + itmtS.status_hide + " " + ") " + "Values ('" + p.item_type_id + "','" + p.item_type_sub_code.Replace("'", "''") + "','" + p.item_type_sub_name_t.Replace("'", "''") + "'," + "'" + p.date_create + "','" + p.date_modi + "','" + p.date_cancel + "'," + "'" + userId + "','" + p.user_modi + "','" + p.user_cancel + "'," + "'" + p.active + "','" + p.remark.Replace("'", "''") + "','" + p.sort1 + "'," + "'" + p.item_type_sub_name_e + "','" + p.f_method_payment_id.Replace("'", "''") + "','" + p.status_invoice + "'," + "'" + p.status_tax53 + "','" + p.acc_code.Replace("'", "''") + "','" + p.status_item_edit.Replace("'", "''") + "', " + "'" + p.tax_id + "','" + p.status_hide + "' " + ")"; try { re = conn.ExecuteNonQuery(conn.conn, sql); } catch (Exception ex) { sql = ex.Message + " " + ex.InnerException; } return(re); }
private void initConfig() { itmtS = new ItemsTypeSub(); 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; chkTax53.Click += ChkTax53_Click; xC.iniDB.itmtDB.setC1CboItemsT(cboItmT, ""); xC.iniDB.fmtpDB.setC1CboMtp(cboFMtp, ""); xC.iniDB.btaxDB.setC1CboItem(cboTax); initGrfDept(); setGrfDeptH(); setControlEnable(false); setFocusColor(); sB1.Text = ""; btnVoid.Hide(); txtPasswordVoid.Hide(); stt = new C1SuperTooltip(); sep = new C1SuperErrorProvider(); //stt.BackgroundGradient = C1.Win.C1SuperTooltip.BackgroundGradient.Gold; cboTax.Hide(); }
public String update(ItemsTypeSub p, String userId) { String re = ""; String sql = ""; int chk = 0; chkNull(p); sql = "Update " + itmtS.table + " Set " + " " + itmtS.item_type_id + " = '" + p.item_type_id + "'" + "," + itmtS.item_type_sub_code + " = '" + p.item_type_sub_code.Replace("'", "''") + "'" + "," + itmtS.item_type_sub_name_t + " = '" + p.item_type_sub_name_t.Replace("'", "''") + "'" + "," + itmtS.remark + " = '" + p.remark.Replace("'", "''") + "'" + "," + itmtS.date_modi + " = now()" + "," + itmtS.user_modi + " = '" + userId + "' " + "," + itmtS.sort1 + " = '" + p.sort1 + "' " + "," + itmtS.item_type_sub_name_e + " = '" + p.item_type_sub_name_e + "' " + "," + itmtS.f_method_payment_id + " = '" + p.f_method_payment_id + "' " + "," + itmtS.status_invoice + " = '" + p.status_invoice + "' " + "," + itmtS.status_tax53 + " = '" + p.status_tax53 + "' " + "," + itmtS.acc_code + " = '" + p.acc_code + "' " + "," + itmtS.status_item_edit + " = '" + p.status_item_edit + "' " + "," + itmtS.tax_id + " = '" + p.tax_id + "' " + "," + itmtS.status_hide + " = '" + p.status_hide + "' " + "Where " + itmtS.pkField + "='" + p.item_type_sub_id + "'" ; try { re = conn.ExecuteNonQuery(conn.conn, sql); } catch (Exception ex) { sql = ex.Message + " " + ex.InnerException; } return(re); }