public FrmPrintTT_SOCTHDA_HDDT(bool isND51) { InitializeComponent(); SmLib.SysFunc.LoadIcon(this); GridSearch.LocalSysObj = StartUp.SysObj; IsND51 = isND51; if (isND51) { GridSearch.ReportGroupName = StartUp.DsTrans.Tables[0].DefaultView[0]["ma_file"].ToString(); } else { GridSearch.ReportGroupName = StartUp.CommandInfo["rep_file"].ToString(); } GridSearch.XGReport.RecordActivated += new EventHandler <Infragistics.Windows.DataPresenter.Events.RecordActivatedEventArgs>(XGReport_RecordActivated); if (BindingSysObj.GetOption("M_LAN").ToString().Equals("V")) { btnExport.Content = BindingSysObj.GetSysVar("M_EXPORT_SIGN").ToString(); } else { btnExport.Content = BindingSysObj.GetSysVar2("M_EXPORT_SIGN").ToString(); } }
public string GetNewSoct(string ma_qs) { string cmd; int M_AUTO_SOCT = Convert.ToInt16(BindingSysObj.GetOption("M_AUTO_SOCT").ToString()); switch (M_AUTO_SOCT) { case 1: cmd = "SELECT transform, so_ct + 1 as so_ct FROM dmqs WHERE ma_qs = '" + ma_qs.Trim() + "'"; break; default: cmd = cmd = "EXEC [GetNewSoct] '" + ma_qs.Trim() + "'"; break; } DataTable tbTmp = BindingSysObj.ExcuteReader(new SqlCommand(cmd)).Tables[0]; if (tbTmp.Rows.Count > 0) { DataRow row = tbTmp.Rows[0]; if (row[1] != null && row[1] != DBNull.Value) { string so_ct_new = row[1].ToString(); return(string.Format(row[0].ToString(), Convert.ToDouble(so_ct_new))); } } return(""); }
private string GetPhFilterExpr() { int maxlenghtSo_ct = BindingSysObj.GetDatabaseFieldLength("so_ct"); string sPhFilter = "1=1 "; if (!string.IsNullOrEmpty(txtNgay_ct1.Text)) { sPhFilter += " and ngay_ct >= " + ConvertDataToSql(txtNgay_ct1.Value, typeof(DateTime)); } if (!string.IsNullOrEmpty(txtNgay_ct2.Text)) { sPhFilter += " and ngay_ct <= " + ConvertDataToSql(txtNgay_ct2.Value, typeof(DateTime)); } if (!string.IsNullOrEmpty(txtSo_ct1.Text)) { //int soct1; //bool isNumber1 = int.TryParse(txtSo_ct1.Text, out soct1); //if (isNumber1 == false) //{ // sPhFilter += " and so_ct >= '" + txtSo_ct1.Text.Trim().PadLeft(maxlenghtSo_ct, ' ') + "'"; //} //else //{ // sPhFilter += "and IsNumeric(so_ct)=1 and so_ct >= " + soct1; //} sPhFilter += " and so_ct >= '" + txtSo_ct1.Text.Trim().PadLeft(maxlenghtSo_ct, ' ') + "'"; } if (!string.IsNullOrEmpty(txtSo_ct2.Text)) { //int soct2; //bool isNumber2 = int.TryParse(txtSo_ct2.Text, out soct2); //if (isNumber2 == false) //{ // sPhFilter += " and so_ct <= '" + txtSo_ct2.Text.Trim().PadLeft(maxlenghtSo_ct, ' ') + "'"; //} //else //{ // sPhFilter += "and IsNumeric(so_ct)=1 and so_ct <= " + soct2; //} sPhFilter += " and so_ct <= '" + txtSo_ct2.Text.Trim().PadLeft(maxlenghtSo_ct, ' ') + "'"; } if (!string.IsNullOrEmpty(txtMa_kh.Text)) { sPhFilter += " and ma_kh = " + ConvertDataToSql(txtMa_kh.Text.Trim(), typeof(string)); } if (!string.IsNullOrEmpty(txtMa_nx.Text)) { sPhFilter += " and ma_nx like " + ConvertDataToSql(txtMa_nx.Text.Trim() + "%", typeof(string)); } if (Convert.ToInt16(txtloc_nsd.Value) == 1) { sPhFilter += " and [user_id] = " + StartUp.M_User_Id; } if (!string.IsNullOrEmpty(txtMaDVCS.Text)) { sPhFilter += " and ma_dvcs LIKE '" + txtMaDVCS.Text.Trim() + "%'"; } if (!SmLib.SysFunc.CheckPermission(SysObj, ActionTask.View, StartUp.Menu_Id)) { sPhFilter += " and " + " AND user_id0 = " + SysObj.UserInfo.Rows[0]["user_id"].ToString(); } if (!string.IsNullOrEmpty(GridSearch.arrStrFilter[0])) { sPhFilter += " and " + GridSearch.arrStrFilter[0]; } return(sPhFilter); }
private void Form_Loaded(object sender, RoutedEventArgs e) { txtso_ct_pt.MaxLength = BindingSysObj.GetDatabaseFieldLength("so_ct"); txtnguoi_nop.MaxLength = BindingSysObj.GetDatabaseFieldLength("ong_ba"); txtlydo_nop.MaxLength = BindingSysObj.GetDatabaseFieldLength("dien_giai"); if (tbInfoPT == null || (tbInfoPT != null && tbInfoPT.Rows.Count == 0)) { txtKind.Value = kind; SqlCommand cmd = new SqlCommand(); cmd.CommandText = "if(select count(1) from dmqs where ma_cts LIKE '%{0}%') = 1"; cmd.CommandText += " select ma_qs from dmqs where ma_cts LIKE '%{1}%'"; if (txtKind.Value.ToString().Equals("1")) { txtMa_qs_pt.Filter = filterma_qs.Replace("HDA", "PT1"); txtMa_gd.Filter = "ma_ct = 'PT1' and status = 1 and ma_gd IN ('2','9')"; cmd.CommandText = string.Format(cmd.CommandText, "PT1", "PT1"); } else { txtMa_qs_pt.Filter = filterma_qs.Replace("HDA", "BC1"); txtMa_gd.Filter = "ma_ct = 'BC1' and status = 1 and ma_gd IN ('2','9')"; cmd.CommandText = string.Format(cmd.CommandText, "BC1", "BC1"); } txtMa_gd.Text = StartUp.CommandInfo["parameter"].ToString().Split(';')[0]; txtMa_gd.SearchInit(); txtMa_gd_PreviewLostFocus(txtMa_gd, null); DataSet ds = BindingSysObj.ExcuteReader(cmd); if (ds.Tables.Count == 1) { txtMa_qs_pt.Text = ds.Tables[0].Rows[0]["ma_qs"].ToString(); } if (StartUp.M_LAN.Equals("V")) { txtlydo_nop.Text = string.Format("Thu tiền hóa đơn số {0}, ngày {1}", so_hd, ngay_hd); } else { txtlydo_nop.Text = string.Format("Invoice no. {0}, invoice date {1}", so_hd, ngay_hd); } } else { txtKind.Value = tbInfoPT.Rows[0]["ma_ct"].ToString().Equals("PT1") ? 1 : 2; if (txtKind.Value.ToString().Equals("1")) { txtMa_qs_pt.Filter = filterma_qs.Replace("HD1", "PT1"); txtMa_gd.Filter = "ma_ct = 'PT1' and status = 1 and ma_gd IN ('2','9')"; } else { txtMa_qs_pt.Filter = filterma_qs.Replace("HD1", "BC1"); txtMa_gd.Filter = "ma_ct = 'BC1' and status = 1 and ma_gd IN ('2','9')"; } txtMa_gd.Text = tbInfoPT.Rows[0]["ma_gd"].ToString(); txtMa_gd.SearchInit(); txtMa_gd_PreviewLostFocus(txtMa_gd, null); txtMa_qs_pt.Text = tbInfoPT.Rows[0]["ma_qs"].ToString(); txtso_ct_pt.Text = tbInfoPT.Rows[0]["so_ct"].ToString().Trim(); txtnguoi_nop.Text = tbInfoPT.Rows[0]["ong_ba"].ToString(); txtlydo_nop.Text = tbInfoPT.Rows[0]["dien_giai"].ToString(); } txtMa_nt.Text = StartUp.M_MA_NT0; if (Ma_nt_ht != StartUp.M_MA_NT0) { txtMa_nt.Filter = "ma_nt IN ('" + StartUp.M_MA_NT0 + "','" + Ma_nt_ht + "')"; } else { txtMa_nt.IsReadOnly = true; txtMa_nt.IsTabStop = false; } txtKind.Focus(); }