protected override void billNew() { GridGoods.DataSource = null; GridGoods.DataBind(); PubFunc.FormLock(FormDoc, false); docSEQNO.Text = string.Empty; docSEQNO.Enabled = false; docFLAG.Enabled = false; docLRY.Enabled = false; tbxYJJJ.Enabled = false; btnCreate.Enabled = true; tbxMEMO.Text = string.Empty; tbxYJJJ.Text = string.Empty; }
private void DataSearch() { if (PubFunc.StrIsEmpty(dpkDATE1.SelectedDate.ToString()) || PubFunc.StrIsEmpty(dpkDATE2.SelectedDate.ToString())) { Alert.Show("输入日期不正确,请检查!"); return; } if (dpkDATE1.SelectedDate > dpkDATE2.SelectedDate) { Alert.Show("开始日期不能大于结束日期!"); return; } int total = 0; string strSql = @"SELECT SUPID, F_GETPRODUCERNAME(SUPID) supname, F_GETDEPTNAME(DEPTID) DEPTNAME , DECODE(KCADD,1,'增库存','减库存') KCADD, round(sum(SL),4) SL , round(sum(LSJE),4) LSJE, round(sum(HSJE),4) HSJE, round(sum(BHSJE),4) BHSJE FROM DAT_GOODSJXC where 1=1 "; string strWhere = ""; strWhere += " AND RQSJ>=TO_DATE('" + dpkDATE1.Text + "','YYYY/MM/DD') AND RQSJ< TO_DATE('" + dpkDATE2.Text + "','YYYY/MM/DD') +1 "; if (!PubFunc.StrIsEmpty(ddlDEPTID.SelectedValue)) { strWhere += " and DEPTID = '" + ddlDEPTID.SelectedValue + "'"; } if (!PubFunc.StrIsEmpty(ddlSUPID.SelectedValue)) { strWhere += " and SUPID = '" + ddlSUPID.SelectedValue + "'"; } strWhere += " group by SUPID,KCADD,DEPTID "; strWhere += " ORDER BY DEPTID,SUPID,KCADD"; if (strWhere.Trim().Length > 0) { strSql = strSql + strWhere; } DataTable dtData = PubFunc.DbGetPage(GridGoods.PageIndex, GridGoods.PageSize, strSql, ref total); GridGoods.RecordCount = total; GridGoods.DataSource = dtData; GridGoods.DataBind(); OutputSummaryData(strSql); }
private void DataSearch() { int total = 0; DataTable dtData = PubFunc.DbGetPage(GridGoods.PageIndex, GridGoods.PageSize, GetSearchSql(), ref total); if (dtData.Rows.Count == 0) { Alert.Show("当前条件无数据,请重新查询。"); return; } GridGoods.RecordCount = total; GridGoods.DataSource = dtData; GridGoods.DataBind(); }
private void DataSearch() { string strSql = @"SELECT A.CODE,A.NAME, nvl(A.DHZQ1,'N') DHZQ1, nvl(A.DHZQ2,'N') DHZQ2, nvl(A.DHZQ3,'N') DHZQ3, nvl(A.DHZQ4,'N') DHZQ4, nvl(A.DHZQ5,'N') DHZQ5, nvl(A.DHZQ6,'N') DHZQ6, nvl(A.DHZQ7,'N') DHZQ7,STR4 FROM SYS_DEPT A WHERE 1=1"; string strSearch = ""; if (!string.IsNullOrWhiteSpace(ddlDEPTID.SelectedValue)) { strSearch = string.Format(" AND A.CODE = '{0}'", ddlDEPTID.SelectedValue); } if (!string.IsNullOrWhiteSpace(ddlPSY.SelectedValue)) { strSearch = string.Format(" AND A.STR4 = '{0}'", ddlPSY.SelectedValue); } if (!string.IsNullOrWhiteSpace(ddlPSTIME.SelectedValue) && string.IsNullOrWhiteSpace(ddlFLAG.SelectedValue)) { Alert.Show("选择【配送时间】后需要同时选择【配送状态】才能查询到信息!", MessageBoxIcon.Warning); return; } if (string.IsNullOrWhiteSpace(ddlPSTIME.SelectedValue) && !string.IsNullOrWhiteSpace(ddlFLAG.SelectedValue)) { strSearch = string.Format(" AND (A.DHZQ1 = '{1}' OR A.DHZQ2 = '{1}' OR A.DHZQ3 = '{1}' OR A.DHZQ4 = '{1}' OR A.DHZQ5 = '{1}' OR A.DHZQ6 = '{1}' OR A.DHZQ7 = '{1}')", ddlPSTIME.SelectedValue, ddlFLAG.SelectedValue); } if (!string.IsNullOrWhiteSpace(ddlPSTIME.SelectedValue) && !string.IsNullOrWhiteSpace(ddlFLAG.SelectedValue)) { strSearch = string.Format(" AND A.{0} = '{1}'", ddlPSTIME.SelectedValue, ddlFLAG.SelectedValue); } if (!string.IsNullOrWhiteSpace(strSearch)) { strSql += strSearch; } //strSql.Append(" order by cfg.deptid(+),g.GDSEQ,g.GDNAME"); strSql += " order by A.CODE"; //int total = 0; GridGoods.DataSource = DbHelperOra.Query(strSql).Tables[0];//GetDataTable(GridGoods.PageIndex, GridGoods.PageSize, strSql, ref total); //GridGoods.RecordCount = total; GridGoods.DataBind(); PageContext.RegisterStartupScript("updateStyle()"); }
private void HDataSearch() { //根据hfdBCode打开对应单据 string strSQL = string.Format(@"SELECT A.DEPTOUT,GDSEQ,GDNAME,f_getunitname(A.UNIT) UNITNAME,GDSPEC,SUM(A.XSSL) SLSL, NVL((SELECT SUM(KCSL-LOCKSL) FROM DAT_GOODSSTOCK WHERE GDSEQ = A.GDSEQ AND KCSL > 0 AND DEPTID = A.DEPTOUT),0) KCSL FROM V_KCSP A WHERE NVL(NUM1,0) = {0} GROUP BY A.DEPTOUT,GDSEQ,GDNAME,UNIT,GDSPEC", hfdBCode.Text); int total = 0; DataTable dtData = PubFunc.DbGetPage(GridGoods.PageIndex, GridGoods.PageSize, strSQL + " ORDER BY GDSEQ", ref total); GridGoods.RecordCount = total; GridGoods.DataSource = dtData; GridGoods.DataBind(); GridGoodsList.DataSource = null; GridGoodsList.DataBind(); }
private void DataSearch() { int total = 0; string sql = @"SELECT sg.GDSEQ,sg.GDNAME,sg.GDSPEC,sg.PIZNO,sg.PRODUCER,sg.ZPBH,dg.NAME,sg.UNIT,ds.SUPNAME FROM DOC_GOODS sg ,doc_supplier ds ,DOC_GOODSUNIT dg WHERE ds.SUPID = sg.SUPPLIER and dg.CODE=sg.UNIT "; StringBuilder strSql = new StringBuilder(sql); if (!string.IsNullOrWhiteSpace(hfdSearch.Text)) { strSql.AppendFormat(" AND (sg.GDSEQ LIKE '%{0}%' OR sg.GDNAME LIKE '%{0}%' OR sg.GDSPEC LIKE '%{0}%' OR sg.PIZNO LIKE '%{0}%' OR ds.SUPNAME LIKE '%{0}%')", hfdSearch.Text); } DataTable dtData = PubFunc.DbGetPage(GridGoods.PageIndex, GridGoods.PageSize, strSql.ToString(), ref total); GridGoods.RecordCount = total; GridGoods.DataSource = dtData; GridGoods.DataBind(); }
protected void page(string strBillno) { strLisSQL = String.Format(strLisSQL, strBillno, "", "", ""); //表体赋值 if (tgxGoods.Text.Trim().Length > 0) { strLisSQL += string.Format(" AND (B.GDSEQ LIKE '%{0}%' OR B.GDNAME LIKE '%{0}%' OR B.ZJM LIKE '%{0}%' OR B.BARCODE LIKE '%{0}%')", tgxGoods.Text.Trim().ToUpper()); } int total = 0; DataTable dtBill = PubFunc.DbGetPage(GridGoods.PageIndex, GridGoods.PageSize, strLisSQL, ref total); GridGoods.RecordCount = total; GridGoods.DataSource = dtBill; GridGoods.DataBind(); DataTable dtSum = DbHelperOra.Query("SELECT SUM(NVL(KCSL,0)) SL,SUM(NVL(HSJE,0)) JE FROM (" + string.Format(strLisSQL, strBillno) + ")").Tables[0]; if (dtSum.Rows.Count > 0) { lblSUBNUM.Text = dtSum.Rows[0]["JE"].ToString(); lblSUBSUM.Text = dtSum.Rows[0]["SL"].ToString(); } decimal bzslTotal = 0, feeTotal = 0, ddslTotal = 0, je1 = 0, je3 = 0; if (dtBill != null && dtBill.Rows.Count > 0) { foreach (DataRow row in dtBill.Rows) { ddslTotal += Convert.ToDecimal(row["KCSL"]); bzslTotal += Convert.ToDecimal(row["PDSL"]); feeTotal += Convert.ToDecimal(row["BZSL"]); je1 += Convert.ToDecimal(row["HSJE"]); je3 += Convert.ToDecimal(row["CYHSJE"]); } } //增加合计 JObject summary = new JObject(); summary.Add("GDNAME", "本页合计"); summary.Add("KCSL", ddslTotal.ToString()); summary.Add("PDSL", bzslTotal.ToString()); summary.Add("BZSL", feeTotal.ToString()); summary.Add("HSJE", je1.ToString("F2")); summary.Add("CYHSJE", je3.ToString("F2")); GridGoods.SummaryData = summary; }
private void DataSearch() { if (PubFunc.StrIsEmpty(dpkDATE1.SelectedDate.ToString()) || PubFunc.StrIsEmpty(dpkDATE2.SelectedDate.ToString())) { Alert.Show("输入日期不正确,请检查!"); return; } if (dpkDATE1.SelectedDate > dpkDATE2.SelectedDate) { Alert.Show("开始日期不能大于结束日期!"); return; } int total = 0; string strSql = @"select ap.*,sp.gdname,sp.gdspec,f_getunitname(sp.unit) UNITNAME,f_getproducername(sp.producer) PRODUCERNAME,sp.hsjj,sp.hsjj*dhs HSJE,DECODE(ap.flag,'N','新单','A','已提交','W','已出库','Y','已收货','已驳回') FLAGNAME from (select a.flag,a.billno,b.gdseq,round(sum(decode(b.memo,'批次拆分',b.dhsl/(select count(1) from dat_db_com c where c.gdseq = b.gdseq and c.seqno= b.seqno),b.dhsl)),0) dhsl,sum(b.xssl) dhs,f_getdeptname(a.deptid) DEPTIDNAME,f_getdeptname(a.deptout) DEPTOUTNAME from dat_db_doc a,dat_db_com b where a.seqno = b.seqno"; string strWhere = ""; if (!PubFunc.StrIsEmpty(ddlDEPTID.SelectedValue)) { strWhere += " and a.deptid = '" + ddlDEPTID.SelectedValue + "'"; } if (!PubFunc.StrIsEmpty(ddlDEPTOUT.SelectedValue)) { strWhere += " and a.deptout = '" + ddlDEPTOUT.SelectedValue + "'"; } if (!PubFunc.StrIsEmpty(tbxBILL.Text)) { strWhere += " and a.seqno like '%" + tbxBILL.Text + "%'"; } strWhere += " and a.xsrq >= TO_DATE('" + dpkDATE1.Text + "','YYYY-MM-DD') and a.xsrq < TO_DATE('" + dpkDATE2.Text + "','YYYY-MM-DD')+1"; strSql = strSql + strWhere + @" group by a.flag,a.billno,b.gdseq,a.deptid,a.deptout) ap,doc_goods sp where ap.gdseq = sp.gdseq"; if (!PubFunc.StrIsEmpty(txbGDSEQ.Text)) { strSql += " and (sp.gdseq like '%" + txbGDSEQ.Text + "%' or sp.gdname like '%" + txbGDSEQ.Text + "%' or sp.zjm like '%" + txbGDSEQ.Text + "%')"; } strSql += " order by decode (ap.flag,'R','1','N','2','A','3','W','4','Y','5')"; DataTable dtData = PubFunc.DbGetPage(GridGoods.PageIndex, GridGoods.PageSize, strSql, ref total); GridGoods.RecordCount = total; GridGoods.DataSource = dtData; GridGoods.DataBind(); }
protected override void billOpen(string strBillno) { //子页中表头赋值 DataTable dtDoc = DbHelperOra.Query(string.Format(strDocSql, strBillno)).Tables[0]; PubFunc.FormDataSet(FormDoc, dtDoc.Rows[0]); if (docFLAG.SelectedValue != "G") { nbxJSJE.Text = nbbYJJJ.Text; } //表体赋值 DataTable dtBill = DbHelperOra.Query(string.Format(strLisSql, strBillno)).Tables[0]; GridGoods.DataSource = dtBill; GridGoods.DataBind(); TabStrip1.ActiveTabIndex = 1; }
protected void GridInIt() { if (GridGoods != null && GridGoods.Rows.Count > 0) { foreach (GridRow row in GridGoods.Rows) { hfdTEMP.Text += row.Values[1].ToString() + ","; } } hfdTEMP.Text = hfdTEMP.Text.TrimEnd(',').Replace(",", "','"); GridGoods.DataSource = DbHelperOra.Query(@"SELECT T.*, DECODE(T.STR1, 'Y', '是', '否') STR1NAME, DECODE(T.ISSUPPLIER, 'Y', '是', '否') ISSUPPLIERNAME, DECODE(T.ISPRODUCER, '2', '是', '否') ISPRODUCERNAME FROM DOC_SUPPLIERTEMP T WHERE T.SUPID IN ('" + hfdTEMP.Text + "')").Tables[0]; GridGoods.DataBind(); hfdTEMP.Text = ""; tgbSearch.Text = string.Empty; }
protected void btnNew_Click(object sender, EventArgs e) { string strDept = docDEPTID.SelectedValue; string strDeptOut = docDEPTOUT.SelectedValue; if (PubFunc.StrIsEmpty(strDept)) { if (docDEPTID.Items.Count > 1) { strDept = docDEPTID.Items[1].Value; } } if (PubFunc.StrIsEmpty(strDeptOut)) { if (docDEPTOUT.Items.Count > 1) { strDeptOut = docDEPTOUT.Items[1].Value; } } docFLAG.SelectedValue = ""; hfdISSH.Text = "N"; btnAudit.Enabled = true; PubFunc.FormDataClear(FormDoc); docSLR.SelectedValue = UserAction.UserID; docLRY.SelectedValue = UserAction.UserID; docLRRQ.SelectedDate = DateTime.Now; docXSRQ.SelectedDate = DateTime.Now; docDEPTID.SelectedValue = strDept; docDEPTOUT.SelectedValue = strDeptOut; docDEPTID.Enabled = true; docSEQNO.Enabled = false; docBILLNO.Text = string.Empty; GridGoods.DataSource = null; GridGoods.DataBind(); JObject summary = new JObject(); summary.Add("GDNAME", "本页合计"); summary.Add("BZSL", "0"); summary.Add("HSJE", "0"); summary.Add("DHSL", "0"); GridGoods.SummaryData = summary; }
private void DataSearch() { string sql = ""; if (DbHelperOra.Exists("SELECT 1 FROM SYS_PARA WHERE CODE = 'ShowName' AND VALUE = 'HIS'")) { sql = @"SELECT SP.GDSEQ,SP.GDID,SP.BARCODE,SP.ZJM,SP.YCODE,SP.NAMEJC,SP.NAMEEN,SP.GDMODE,SP.STRUCT,SP.BZHL,SP.UNIT,SP.FLAG,SP.CATID,SP.JX,SP.YX,SP.PIZNO,SP.BAR1,SP.BAR2,SP.BAR3,SP.DEPTID,SP.SUPPLIER,SP.LOGINLABEL,SP.PRODUCER,SP.ZPBH,SP.PPID,SP.CDID,SP.JXTAX,SP.XXTAX,SP.BHSJJ,SP.HSJJ,SP.LSJ,SP.YBJ,SP.HSID,SP.HSJ,SP.JHZQ,SP.ZDKC, SP.HLKC,SP.ZGKC,SP.SPZT,SP.DAYXS,SP.MANAGER,SP.INPER,SP.INRQ,SP.BEGRQ,SP.ENDRQ,SP.UPTRQ,SP.UPTUSER,SP.MEMO,DISABLEORG,SP.ISLOT,SP.ISJB,SP.ISFZ,SP.ISGZ,SP.ISIN,SP.ISJG,SP.ISDM,SP.ISCF,SP.ISYNZJ,SP.ISFLAG1,nvl(SP.STR3,SP.GDSPEC) GDSPEC,SP.UNIT_DABZ,SP.UNIT_ZHONGBZ,SP.BARCODE_DABZ,SP.NUM_DABZ,SP.NUM_ZHONGBZ,SP.UNIT_ORDER,SP.UNIT_SELL,SP.HISCODE,nvl(SP.HISNAME,SP.GDNAME) GDNAME,SP.CATID0, F_GETUNITNAME(UNIT) UNITNAME,F_GETPRODUCERNAME(SP.PRODUCER) PRODUCERNAME,F_GETSUPNAME(SUPPLIER) SUPPLIERNAME,(nvl(PZ.DSNUM,0) - nvl(PZ.NUM3,0)- nvl(PZ.DSPOOL,0)) sum_num,PZ.DSNUM,nvl(PZ.NUM1,0) NUM_XS,nvl(PZ.NUM3,0) NUM_DS, F_GETUNITNAME(UNIT_ORDER) UNIT_ORDER_NAME,F_GETUNITNAME(UNIT_SELL) UNIT_SELL_NAME,F_GETUNITNAME(UNIT_DABZ) UNIT_DABZ_NAME,NVL(PZ.ISJF,'Y') ISJF, F_GETUNITNAME(UNIT_ZHONGBZ) UNIT_ZHONGBZ_NAME,f_gethwid('{1}',SP.GDSEQ) HWID,NVL((SELECT wmsys.wm_concat(gdseq) FROM VIEW_DS WHERE GDSEQ_OLD = SP.GDSEQ AND DEPTID = '{0}'),'不存在') DT"; } else { sql = @"SELECT SP.GDSEQ,SP.GDID,SP.BARCODE,SP.ZJM,SP.YCODE,SP.NAMEJC,SP.NAMEEN,SP.GDMODE,SP.STRUCT,SP.BZHL,SP.UNIT,SP.FLAG,SP.CATID,SP.JX,SP.YX,SP.PIZNO,SP.BAR1,SP.BAR2,SP.BAR3,SP.DEPTID,SP.SUPPLIER,SP.LOGINLABEL,SP.PRODUCER,SP.ZPBH,SP.PPID,SP.CDID,SP.JXTAX,SP.XXTAX,SP.BHSJJ,SP.HSJJ,SP.LSJ,SP.YBJ,SP.HSID,SP.HSJ,SP.JHZQ,SP.ZDKC, SP.HLKC,SP.ZGKC,SP.SPZT,SP.DAYXS,SP.MANAGER,SP.INPER,SP.INRQ,SP.BEGRQ,SP.ENDRQ,SP.UPTRQ,SP.UPTUSER,SP.MEMO,DISABLEORG,SP.ISLOT,SP.ISJB,SP.ISFZ,SP.ISGZ,SP.ISIN,SP.ISJG,SP.ISDM,SP.ISCF,SP.ISYNZJ,SP.ISFLAG1,nvl(SP.STR3,SP.GDSPEC) GDSPEC,SP.UNIT_DABZ,SP.UNIT_ZHONGBZ,SP.BARCODE_DABZ,SP.NUM_DABZ,SP.NUM_ZHONGBZ,SP.UNIT_ORDER,SP.UNIT_SELL,SP.HISCODE,SP.GDNAME,SP.CATID0, F_GETUNITNAME(UNIT) UNITNAME,F_GETPRODUCERNAME(SP.PRODUCER) PRODUCERNAME,F_GETSUPNAME(SUPPLIER) SUPPLIERNAME,(nvl(PZ.DSNUM,0) - nvl(PZ.NUM3,0)- nvl(PZ.DSPOOL,0)) sum_num,PZ.DSNUM,nvl(PZ.NUM1,0) NUM_XS,nvl(PZ.NUM3,0) NUM_DS, F_GETUNITNAME(UNIT_ORDER) UNIT_ORDER_NAME,F_GETUNITNAME(UNIT_SELL) UNIT_SELL_NAME,F_GETUNITNAME(UNIT_DABZ) UNIT_DABZ_NAME,NVL(PZ.ISJF,'Y') ISJF, F_GETUNITNAME(UNIT_ZHONGBZ) UNIT_ZHONGBZ_NAME,f_gethwid('{1}',SP.GDSEQ) HWID,NVL((SELECT wmsys.wm_concat(gdseq) FROM VIEW_DS WHERE GDSEQ_OLD = SP.GDSEQ AND DEPTID = '{1}'),'不存在') DT"; } StringBuilder strSql = new StringBuilder(string.Format(sql, hfdDept.Text, hfdSearch.Text)); if (!string.IsNullOrWhiteSpace(hfdSearch.Text)) { strSql.AppendFormat(" ,(select nvl(sum(KCSL -LOCKSL),0) from DAT_GOODSSTOCK a where a.gdseq = SP.GDSEQ and a.deptid = '{0}') KCSL,floor((select nvl(sum(KCSL - LOCKSL),0) from DAT_GOODSSTOCK a where a.gdseq = SP.GDSEQ and a.deptid = '{0}')/PZ.NUM1) SL", hfdSearch.Text); } if (!string.IsNullOrWhiteSpace(hfdDept.Text)) { strSql.AppendFormat(" from DOC_GOODS SP,DOC_GOODSCFG PZ WHERE SP.FLAG IN('Y','T') AND ISDELETE='N' AND SP.GDSEQ=PZ.GDSEQ AND PZ.DSNUM > 0 AND nvl(PZ.NUM3,0) + nvl(PZ.DSPOOL,0) <= nvl(PZ.DSNUM,0) and nvl(PZ.NUM1,0) > 0 AND PZ.DEPTID='{0}' AND PZ.ISCFG IN ('1','Y') and (nvl(PZ.DSNUM, 0) - nvl(PZ.NUM3, 0) - nvl(PZ.DSPOOL, 0))>0 AND EXISTS(SELECT 1 FROM DOC_GOODSSUP GS WHERE GS.GDSEQ=SP.GDSEQ AND GS.SUPID IS NOT NULL) ", hfdDept.Text); } if (!string.IsNullOrWhiteSpace(trbSearch.Text)) { strSql.AppendFormat(" AND (SP.GDSEQ LIKE '%{0}%' OR SP.GDNAME LIKE '%{0}%' OR SP.ZJM LIKE '%{0}%' OR SP.BARCODE LIKE '%{0}%')", trbSearch.Text.Trim().ToUpper()); } if (!string.IsNullOrWhiteSpace(hfdSearch.Text)) { strSql.AppendFormat(" AND EXISTS(SELECT 1 FROM DOC_GOODSCFG K WHERE K.DEPTID = '{0}' AND K.GDSEQ = SP.GDSEQ)", hfdSearch.Text.Trim()); } strSql.Append(" ORDER BY SP.GDNAME,KCSL"); GridGoods.DataSource = DbHelperOra.Query(strSql.ToString()).Tables[0]; GridGoods.DataBind(); }
private void SearchTwo() { //从数据平台取得数据 DataTable dt = new DataTable(); try { JObject result = ApiClientService.query("DOC_GOODS_All", (GridGoods.PageIndex * GridGoods.PageSize).ToString(), ((GridGoods.PageIndex + 1) * GridGoods.PageSize).ToString(), ddlGoodsState.SelectedValue.Trim(), trbSearch.Text.Trim()); if ("success".Equals(result.Value <String>("result"))) { String serJa = JsonConvert.SerializeObject(result.Value <JArray>("data")); dt = JsonConvert.DeserializeObject <DataTable>(serJa); GridGoods.RecordCount = Convert.ToInt32((dt.Rows[0]["TOTAL"] ?? "0")); GridGoods.DataSource = dt; GridGoods.DataBind(); } else { String reason = result.Value <String>("reason"); Exception ex = new Exception(reason); throw ex; } } catch (Exception ex) { Alert.Show(ex.Message + ex.StackTrace, "获取商品信息时超时,请重新再试!", MessageBoxIcon.Error); } // string Stearch = ""; // if (!PubFunc.StrIsEmpty(trbSearch.Text)) // { // Stearch += string.Format(" AND (A.GDSEQ LIKE '%{0}%' OR A.GDNAME LIKE '%{0}%' OR A.BAR3 LIKE '%{0}%')", trbSearch.Text); // } // Stearch += " ORDER BY GDSEQ"; // int total = 0; // string mysql = @"SELECT A.*,DECODE(A.FLAG,'Y','正常','未下传') FLAGNAME,C.NAME UNITNAME,B.name PRODUCERNAME // FROM DOC_GOODS A,DOC_PRODUCER B,DOC_GOODSUNIT C // WHERE A.UNIT = C.CODE(+) AND A.PRODUCER = B.code(+) "; // DataTable dtData = PubFunc.DbGetPage(GridGoods.PageIndex, GridGoods.PageSize, mysql + Stearch, ref total); // GridGoods.RecordCount = total; // GridGoods.DataSource = dtData; // GridGoods.DataBind(); }
private void DataQuery() { int total = 0; lblSUBNUM.Text = "0"; lblSUBSUM.Text = "0"; DataTable dtSum = DbHelperOra.Query("SELECT SUM(NVL(SL,0)) SL,SUM(NVL(JE,0)) JE FROM (" + GetQuerySql() + ")").Tables[0]; if (dtSum.Rows.Count > 0) { lblSUBNUM.Text = dtSum.Rows[0]["JE"].ToString(); lblSUBSUM.Text = dtSum.Rows[0]["SL"].ToString(); } DataTable dtData = GetDataTable(GridGoods.PageIndex, GridGoods.PageSize, GetQuerySql(), ref total); OutputSummaryData(dtData); GridGoods.RecordCount = total; GridGoods.DataSource = dtData; GridGoods.DataBind(); }
protected void btClear_Click(object sender, EventArgs e) { if (TabStrip1.ActiveTabIndex == 0) { dpkDATE1.SelectedDate = DateTime.Now.AddMonths(-3); dpkDATE2.SelectedDate = DateTime.Now; // lstDEPTID.SelectedValue = ""; //ddlISGZ.SelectedValue = ""; GridGoods.DataBind(); } if (TabStrip1.ActiveTabIndex == 1) { lisDATE1.SelectedDate = DateTime.Now.AddMonths(-3); lisDATE2.SelectedDate = DateTime.Now; lisGDSEQ.Text = String.Empty; lstISGZ.SelectedValue = ""; GridList.DataBind(); } }
protected override void billDelRow() { if ((",M,R").IndexOf(ddlFLAG.SelectedValue) < 0) { Alert.Show("非『新增』单据不能删行!", "消息提示", MessageBoxIcon.Warning); return; } if (GridGoods.SelectedRowID == null) { Alert.Show("当前没有选中行,无法进行【删行】操作", "操作警告", MessageBoxIcon.Warning); return; } int[] rowId = GridGoods.SelectedRowIndexArray; for (int i = 0; i < rowId.Length; i++) { GridGoods.DataSource = DeleteRowByID(rowId[i]); GridGoods.DataBind(); } //GridGoods.DeleteSelectedRows(); }
private void DataSearch() { if (PubFunc.StrIsEmpty(dpkDATE1.SelectedDate.ToString()) || PubFunc.StrIsEmpty(dpkDATE2.SelectedDate.ToString())) { Alert.Show("输入日期不正确,请检查!"); return; } if (dpkDATE1.SelectedDate > dpkDATE2.SelectedDate) { Alert.Show("开始日期不能大于结束日期!"); return; } int total = 0; DataTable dtData = PubFunc.DbGetPage(GridGoods.PageIndex, GridGoods.PageSize, GetSearchSql(), ref total); GridGoods.RecordCount = total; GridGoods.DataSource = dtData; GridGoods.DataBind(); }
private void DataSearch() { int total = 0; String Sql = @"SELECT A.CUSTID,A.OPTID,A.DOCTOR,A.STR9,A.STR7,A.STR8,A.OPTTABLE,A.DEPTID,f_getdeptname(A.DEPTID) DEPTNAME,COUNT(1) SL,A.SUBSUM JE,A.NUM4 FROM DAT_XS_DOC A,DAT_XS_EXT C,DOC_GOODS D WHERE A.SEQNO = C.BILLNO AND C.GDSEQ = D.GDSEQ AND NVL(A.CUSTID,'#') <> '#' AND A.FLAG <> 'M'"; string strSearch = ""; if (trbGDSEQ.Text.Trim().Length > 0) { strSearch += string.Format(" AND (D.GDSEQ LIKE '%{0}%' OR D.GDNAME LIKE '%{0}%' OR D.ZJM LIKE '%{0}%' OR D.BARCODE LIKE '%{0}%')", trbGDSEQ.Text.Trim().ToUpper()); } if (tbxPatient.Text.Trim().Length > 0) { strSearch += string.Format(" AND (A.CUSTID LIKE '%{0}%' OR A.OPTID LIKE '%{0}%' OR A.DOCTOR LIKE '%{0}%' OR A.STR9 LIKE '%{0}%' OR A.STR7 LIKE '%{0}%' OR A.STR8 LIKE '%{0}%')", tbxPatient.Text.Trim()); } if (lstDEPTID.SelectedValue.Length > 0) { strSearch += " AND A.DEPTID ='" + lstDEPTID.SelectedValue + "'"; } if (tbxONECODE.Text.Trim().Length > 0) { strSearch += " AND C.ONECODE ='" + tbxONECODE.Text + "'"; } if (dpkout1.SelectedDate != null) { strSearch += string.Format(" AND A.SHRQ >= TO_DATE('{0}','YYYY-MM-DD')", dpkout1.Text); } if (dpkout2.SelectedDate != null) { strSearch += string.Format(" AND A.SHRQ < TO_DATE('{0}','YYYY-MM-DD')+1", dpkout2.Text); } strSearch += " GROUP BY A.CUSTID,A.OPTID,A.DOCTOR,A.STR9,A.STR7,A.STR8,A.OPTTABLE,A.DEPTID,A.SUBSUM,A.NUM4"; DataTable dtData = PubFunc.DbGetPage(GridGoods.PageIndex, GridGoods.PageSize, Sql + strSearch, ref total); GridGoods.RecordCount = total; GridGoods.DataSource = dtData; GridGoods.DataBind(); }
private void dataSearch() { //builder.Append("SELECT TA.GDSEQ,TA.GDNAME,TA.GDSPEC,TB.NAME CATID0NAME,F_GETCATNAME(TA.CATID) CATIDNAME,f_getunitname(TA.UNIT) UNITNAME,"); //builder.Append("f_getproducername(TA.PRODUCER) producername,f_getsupname(TC.SUPID) SUPNAME,'请选择新供应商' NEWSUPNAME,ta.supplier newsupid,TA.PIZNO,(CASEWHEN TA.FLAG = 'Y' THEN"); //builder.Append("'正常'when TA.flag = 'T' THEN'停购'when TA.flag = 'S' THEN'停销'WHEN TA.FLAG = 'N' THEN'新品'when TA.flag = 'E' THEN"); //builder.Append("'淘汰'END) FLAGFROM DOC_GOODS TA, DOC_GOODSTYPE TB, DOC_GOODSSUP TC WHERE TA.CATID0 = TB.CODE AND TA.GDSEQ = TC.GDSEQ(+)"); builder.Append(@"SELECT TA.GDSEQ, TA.GDNAME, TA.GDSPEC, TB.NAME CATID0NAME, F_GETCATNAME(TA.CATID) CATIDNAME, f_getunitname(TA.UNIT) UNITNAME, f_getproducername(TA.PRODUCER) producername, f_getsupname(TC.SUPID) SUPNAME, '请选择新供应商' NEWSUPNAME, ta.supplier newsupid, TA.PIZNO,(CASE WHEN TA.FLAG = 'Y' THEN '正常'when TA.flag = 'T' THEN '停购' when TA.flag = 'S' THEN '停销' WHEN TA.FLAG = 'N' THEN '新品' when TA.flag = 'E' THEN '淘汰' END )FLAG FROM DOC_GOODS TA ,DOC_GOODSTYPE TB ,DOC_GOODSSUP TC WHERE TA.CATID0=TB.CODE AND TA.GDSEQ=TC.GDSEQ(+)"); if (trbSearch.Text.Length > 0) { builder.Append(" and (gdseq like '%" + trbSearch.Text + "%' or gdname like '%" + trbSearch.Text + "%' or zjm like '%" + trbSearch.Text + "%')"); } int total = 0; dtData = PubFunc.DbGetPage(GridGoods.PageIndex, GridGoods.PageSize, builder.ToString(), ref total); GridGoods.RecordCount = total; GridGoods.DataSource = dtData; GridGoods.DataBind(); StringBuilder builderstr = new StringBuilder(); foreach (DataRow dr in dtData.Rows) { foreach (DataColumn column in dtData.Columns) { string datafile = column.ColumnName; builderstr.Append(datafile + "@" + dr[column].ToString() + "♂"); } builderstr.Append("★"); } if (builderstr.ToString().Length > 0) { hdfgood.Text = builderstr.ToString(); } }
protected override void billOpen(string strBillno) { //表头进行赋值 DataTable dtDoc = DbHelperOra.Query(string.Format(strDocSql, strBillno)).Tables[0]; PubFunc.FormDataSet(FormDoc, dtDoc.Rows[0]); //表体赋值 DataTable dtBill = new DataTable(); dtBill = DbHelperOra.Query(string.Format(strLisSQL, strBillno)).Tables[0]; GridGoods.DataSource = dtBill; GridGoods.DataBind(); TabStrip1.ActiveTabIndex = 1; //增加合计 decimal bzslTotal = 0, feeTotal = 0, ddslTotal = 0, je1 = 0, je2 = 0, je3 = 0; if (dtBill != null && dtBill.Rows.Count > 0) { foreach (DataRow row in dtBill.Rows) { ddslTotal += Convert.ToDecimal(row["KCSL"]); bzslTotal += Convert.ToDecimal(row["SYSL"]); feeTotal += Convert.ToDecimal(row["KCHSJE"]); je1 += Convert.ToDecimal(row["HSJE"]); je2 += Convert.ToDecimal(row["BHSJE"]); je3 += Convert.ToDecimal(row["LSJE"]); } } JObject summary = new JObject(); summary.Add("GDNAME", "本页合计"); summary.Add("KCSL", ddslTotal.ToString()); summary.Add("SYSL", bzslTotal.ToString()); summary.Add("KCHSJE", feeTotal.ToString("F2")); summary.Add("HSJE", je1.ToString("F2")); summary.Add("BHSJE", je2.ToString("F2")); summary.Add("LSJE", je3.ToString("F2")); GridGoods.SummaryData = summary; }
protected override void billNew() { //原单据保存判断 PubFunc.FormDataClear(FormProducer); PubFunc.FormDataClear(FormDoc); dpkLRRQ.SelectedDate = DateTime.Now; ddlFLAG.SelectedValue = "M"; docLRY.SelectedValue = UserAction.UserID; billLockDoc(false); btnPrint.Enabled = false; btnAddRow.Enabled = true; btnUpdate.Enabled = true; btnDelect.Enabled = true; btnDelRow.Enabled = true; btnSave.Enabled = true; tbxBILLNO.Enabled = false; btnGoods.Enabled = true; ddlType.Enabled = true; btnDel.Enabled = true; hfdIsNew.Text = ""; GridGoods.DataSource = null; GridGoods.DataBind(); }
private void DataSearch() { int total = 0; string msg = ""; NameValueCollection nvc = new NameValueCollection(); if (ddlDEPTID.SelectedValue.Length > 0) { nvc.Add("DEPTID", ddlDEPTID.SelectedValue); } if (tbxGDSEQ.Text.Length > 0) { nvc.Add("SEQ", tbxGDSEQ.Text); } if (tbxGDSEQ_OLD.Text.Length > 0) { nvc.Add("SEQ_OLD", tbxGDSEQ_OLD.Text); } if (ddlTYPE.SelectedValue.Length > 0) { nvc.Add("TYPE", ddlTYPE.SelectedValue); } if (tbxSEQNO.Text.Length > 0) { nvc.Add("SEQNO", tbxSEQNO.Text); } if (ddlSTR1.SelectedValue.Length > 0) { nvc.Add("STR1", ddlSTR1.SelectedValue); } DataTable dtData = GetGoodsList(GridGoods.PageIndex, GridGoods.PageSize, nvc, ref total, ref msg); GridGoods.RecordCount = total; GridGoods.DataSource = dtData; GridGoods.DataBind(); }
private void DataSearch() { if (PubFunc.StrIsEmpty(dpkDATE1.SelectedDate.ToString()) || PubFunc.StrIsEmpty(dpkDATE2.SelectedDate.ToString())) { Alert.Show("【输入日期】不正确,请检查!", MessageBoxIcon.Warning); return; } if (dpkDATE1.SelectedDate > dpkDATE2.SelectedDate) { Alert.Show("【开始日期】不能大于【结束日期】!", MessageBoxIcon.Warning); return; } string strSql = @"SELECT A.SUPID,A.SUPNAME,SUM(DECODE(B.BILLTYPE,'XST',-ABS(B.SL),'LTD',-ABS(B.SL),'DST',-ABS(B.SL),ABS(B.SL))) XSSL, SUM(DECODE(B.BILLTYPE,'XST',-ABS(B.HSJE),'LTD',-ABS(B.HSJE),'DST',-ABS(B.HSJE),ABS(B.HSJE))) XSJE, ROUND(SUM(DECODE(B.BILLTYPE,'XST',-ABS(B.SL),'LTD',-ABS(B.SL),'DST',-ABS(B.SL),ABS(B.SL)))/(SELECT SUM(DECODE(BB.BILLTYPE,'XST',-ABS(BB.SL),'LTD',-ABS(BB.SL),'DST',-ABS(BB.SL),ABS(BB.SL))) FROM DAT_GOODSJXC BB WHERE BB.RQSJ BETWEEN TO_DATE('{0}','yyyy-MM-dd') AND TO_DATE('{1}','yyyy-MM-dd') + 1),4) SLZB, ROUND(SUM(DECODE(B.BILLTYPE,'XST',-ABS(B.HSJE),'LTD',-ABS(B.HSJE),'DST',-ABS(B.HSJE),ABS(B.HSJE)))/(SELECT SUM(DECODE(BB.BILLTYPE,'XST',-ABS(BB.HSJE),'LTD',-ABS(BB.HSJE),'DST',-ABS(BB.HSJE),ABS(BB.HSJE))) FROM DAT_GOODSJXC BB WHERE BB.RQSJ BETWEEN TO_DATE('{0}','yyyy-MM-dd') AND TO_DATE('{1}','yyyy-MM-dd') + 1),4) JEZB FROM DOC_SUPPLIER A,DAT_GOODSJXC B WHERE A.ISSUPPLIER = 'Y' AND A.SUPID = B.SUPID AND B.RQSJ BETWEEN TO_DATE('{0}','yyyy-MM-dd') AND TO_DATE('{1}','yyyy-MM-dd') + 1 {2} GROUP BY A.SUPID,A.SUPNAME"; string strWhere = ""; if (lstSUPTID.SelectedValue.Length > 0) { strWhere += " AND A.SUPID = '" + lstSUPTID.SelectedValue + "'"; } string sortField = GridGoods.SortField; string sortDirection = GridGoods.SortDirection; GridGoods.DataSource = DbHelperOra.QueryForTable(string.Format(strSql, dpkDATE1.Text, dpkDATE2.Text, strWhere) + String.Format(" ORDER BY {0} {1}", sortField, sortDirection)); GridGoods.DataBind(); }
private void dataSearch() { string strsql = @"SELECT RIG.YAZ01,RIG.DEPTID,(SELECT NAME FROM SYS_DEPT WHERE CODE=RIG.DEPTID)DEPTNAME,RIG.FLAG,DECODE(RIG.FLAG,'Y','处理成功','N','未处理','E','异常') FLAGNAME,RIG.BBY04,(SELECT GDNAME FROM DOC_GOODS WHERE GDSEQ=RIG.BBY04)GDNAME ,RIG.VAJ25,RIG.YAZ20,RIG.PRODATE,RIG.MEMO FROM INF_DOC_GOODS IDG WHERE IDG.FLAG<>'H' "; string where = ""; if (dpkBEGRQ.SelectedDate == null || dpkENDRQ.SelectedDate == null) { Alert.Show("时间填写不能为空!"); return; } else { if (dpkENDRQ.SelectedDate > dpkENDRQ.SelectedDate) { Alert.Show("开始时间不能晚于结束时间!"); } } if (srhFLAG.SelectedValue == "Y") { where += " AND RIG.FLAG='E' "; } else if (srhFLAG.SelectedValue == "N") { where += " AND RIG.FLAG IN('Y','N') "; } where += string.Format("AND RIG.YAZ20>=TO_DATE('{0}','YYYY-MM-DD HH24:MI:SS') AND RIG.YAZ20<=TO_DATE('{1}','YYYY-MM-DD HH24:MI:SS') ORDER BY DECODE(RIG.FLAG,'E','1','N','2','Y','3')", dpkBEGRQ.SelectedDate, dpkENDRQ.SelectedDate); int total = 0; strsql += where; DataTable dt = PubFunc.DbGetPage(GridGoods.PageIndex, GridGoods.PageSize, strsql, ref total); GridGoods.RecordCount = total; GridGoods.DataSource = dt; GridGoods.DataBind(); }
protected void btnSrh_Click(object sender, EventArgs e) { if (ddlSUPID.SelectedValue.Length < 1) { Alert.Show("请选择结算【供应商】", MessageBoxIcon.Warning); return; } //查询需结算单据 string Sql = string.Format(@"SELECT A.*,DECODE(A.FLAG,'J','已登记','D','部分结算','已结算') FLAGNAME,F_GET_BILLTYPENAME(A.BILLTYPE) BILLTYPENAME,f_getdeptname(A.DEPTOUT) DEPTOUTNAME,f_getdeptname(A.DEPTID) DEPTIDNAME, DECODE(XSTYPE,'1','申领','申退') XSTYPENAME,f_getusername(A.LRY) LRYNAME,f_getusername(A.SHR) SHRNAME,ABS((SELECT SUM(HSJE) FROM DAT_GOODSJXC B WHERE NVL(B.PSSID,B.SUPID) = '{2}' AND B.BILLNO = A.SEQNO AND NVL(STR1,'#') = '#')) SUPSUM FROM DAT_XS_DOC A, DAT_XS_COM B WHERE A.SEQNO=B.SEQNO AND A.FLAG IN ('J','D') AND A.SHRQ BETWEEN TO_DATE('{0}','YYYY-MM-DD') AND TO_DATE('{1}','YYYY-MM-DD') + 1 AND A.BILLTYPE='XSG' AND EXISTS(SELECT 1 FROM DAT_GOODSJXC B WHERE NVL(B.PSSID,B.SUPID) = '{2}' AND B.BILLNO = A.SEQNO AND NVL(STR1,'#') = '#')", docJSKS.Text, docJSJS.Text, ddlSUPID.SelectedValue); string strSearch = ""; if (docDEPTID.SelectedValue.Length > 0) { strSearch += string.Format(" AND A.DEPTID LIKE '{0}'", docDEPTID.SelectedValue); } if (ddlNUM2.SelectedValue == "G") { strSearch += string.Format(" AND B.ISGZ LIKE '{0}'", "Y"); } else { strSearch += string.Format(" AND B.ISGZ LIKE '{0}'", "N"); } if (tgbCKDH.Text.Length > 0) { strSearch += string.Format(" AND A.SEQNO LIKE '%{0}%'", tgbCKDH.Text); } strSearch += " ORDER BY A.DEPTID,A.SEQNO DESC"; GridGoods.DataSource = DbHelperOra.Query(Sql + strSearch).Tables[0]; GridGoods.DataBind(); }
private void DataSearch() { int total = 0; //使用his名称、规格,SP.GDNAME,SP.GDSPEC string sql = @"select SP.GDSEQ,SP.GDID,SP.BARCODE,SP.ZJM,SP.YCODE,SP.NAMEJC,SP.NAMEEN,SP.GDMODE,SP.STRUCT,SP.BZHL,SP.UNIT,SP.FLAG,SP.CATID,SP.JX,SP.YX,SP.PIZNO,SP.BAR1,SP.BAR2,SP.BAR3,SP.DEPTID,SP.SUPPLIER,SP.LOGINLABEL,SP.PRODUCER,SP.ZPBH,SP.PPID,SP.CDID,SP.JXTAX,SP.XXTAX,SP.BHSJJ,SP.HSJJ,SP.LSJ,SP.YBJ,SP.HSID,SP.HSJ,SP.JHZQ,PZ.ZDKC, SP.HLKC,SP.ZGKC,SP.SPZT,SP.DAYXS,SP.MANAGER,SP.INPER,SP.INRQ,SP.BEGRQ,SP.ENDRQ,SP.UPTRQ,SP.UPTUSER,SP.MEMO,DISABLEORG,SP.ISLOT,SP.ISJB,SP.ISFZ,SP.ISGZ,SP.ISIN,SP.ISJG,SP.ISDM,SP.ISCF,SP.ISYNZJ,SP.ISFLAG1,nvl(SP.STR3,SP.GDSPEC) GDSPEC,SP.UNIT_DABZ,SP.UNIT_ZHONGBZ,SP.BARCODE_DABZ,SP.NUM_DABZ,SP.NUM_ZHONGBZ,SP.UNIT_ORDER,SP.UNIT_SELL,SP.HISCODE,nvl(SP.HISNAME,SP.GDNAME) GDNAME,SP.CATID0, F_GETUNITNAME(UNIT) UNITNAME,F_GETPRODUCERNAME(SP.PRODUCER) PRODUCERNAME,F_GETSUPNAME(SUPPLIER) SUPPLIERNAME, F_GETUNITNAME(UNIT_ORDER) UNIT_ORDER_NAME,F_GETUNITNAME(UNIT_SELL) UNIT_SELL_NAME,F_GETUNITNAME(UNIT_DABZ) UNIT_DABZ_NAME, F_GETUNITNAME(UNIT_ZHONGBZ) UNIT_ZHONGBZ_NAME,PZ.HJCODE1 HWID,NVL(PZ.NUM1,0) NUM1,NVL(PZ.NUM3,0) NUM3,NVL(PZ.DSNUM,0) DSNUM from DOC_GOODS SP,DOC_GOODSCFG PZ WHERE ISDELETE='N' and sp.flag='Y' AND SP.GDSEQ=PZ.GDSEQ(+) "; StringBuilder strSql = new StringBuilder(sql); if (!string.IsNullOrWhiteSpace(hfdSearch.Text)) { strSql.AppendFormat(" AND (SP.GDSEQ LIKE '%{0}%' OR SP.GDNAME LIKE '%{0}%' OR SP.ZJM LIKE '%{0}%' OR SP.BARCODE LIKE '%{0}%')", hfdSearch.Text.ToUpper()); } if (!string.IsNullOrWhiteSpace(hfdDept.Text)) { strSql.AppendFormat(" AND PZ.DEPTID='{0}' AND PZ.ISCFG IN ('1','Y')", hfdDept.Text); } if (hfdSupplier.Text == "N") { strSql.AppendFormat(" AND SP.ISGZ = 'N'"); } else { strSql.AppendFormat(" AND SP.ISGZ = 'Y'"); } strSql.AppendFormat(" ORDER BY SP.{0} {1}", GridGoods.SortField, GridGoods.SortDirection); DataTable dtData = PubFunc.DbGetPage(GridGoods.PageIndex, GridGoods.PageSize, strSql.ToString(), ref total); GridGoods.RecordCount = total; GridGoods.DataSource = dtData; GridGoods.DataBind(); }
private void DataInit() { // 新增数据初始值 JObject defaultObj = new JObject(); defaultObj.Add("GDSEQ", ""); defaultObj.Add("NAME", ""); defaultObj.Add("GDSPEC", ""); defaultObj.Add("UNIT", ""); defaultObj.Add("BZHL", ""); defaultObj.Add("ZPBH", ""); defaultObj.Add("SPLB", ""); defaultObj.Add("CDID", ""); defaultObj.Add("SUPID", ""); defaultObj.Add("HSJJ", ""); defaultObj.Add("DHS", ""); defaultObj.Add("HSJE", ""); defaultObj.Add("KCSL", ""); defaultObj.Add("CKBM", ""); defaultObj.Add("LOT", ""); defaultObj.Add("BZRQ", ""); // 在第一行新增一条数据 //btnAddRow.OnClientClick = GridGoods.GetAddNewRecordReference(defaultObj, AppendToEnd); // 删除选中行按钮 //btnDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("请至少选择一项!") + deleteScript; PubFunc.DdlDataGet(ddlGoodsType, "DDL_GOODS_TYPE"); dpkOrderDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); BindGrid(); dtOrders = GetDataTableGoods();//DbHelperOra.Query("select GDSEQ,NAME, GDSPEC, UNIT, BZHL, ZPBH, SPLB, CDID, SUPID, HSJJ, DHS, HSJE, KCSL, CKBM, LOT, BZRQ from DAT_DD_COM where 1=2").Tables[0]; GridGoods.DataSource = dtOrders; GridGoods.DataBind(); }
private void DataSearch() { if (PubFunc.StrIsEmpty(dpkDATE1.SelectedDate.ToString()) || PubFunc.StrIsEmpty(dpkDATE2.SelectedDate.ToString())) { Alert.Show("输入日期不正确,请检查!"); return; } if (dpkDATE1.SelectedDate > dpkDATE2.SelectedDate) { Alert.Show("开始日期不能大于结束日期!"); return; } //int total = 0; string strSql = @"select sp.gdseq, F_GETHISINFO(sp.gdseq, 'GDNAME') GDNAME, f_getsupname(sj.supplier) supName, F_GETUNITNAME(sj.unit) unitname, F_GETHISINFO(sp.gdseq, 'gdspec') GDSPEC, F_GETPRODUCERNAME(sj.producer) producername, sp.dhs, nvl(sq.rks, 0) RKS, (sp.dhs - nvl(sq.rks, 0)) CYS, (sj.HSJJ*sp.dhs) dhje, nvl(sj.HSJJ,0)*nvl(sq.rks,0) RKJE, (nvl(sj.HSJJ,0)*nvl(sp.dhs,0)) - nvl(sj.HSJJ,0)*nvl(sq.rks,0) CYJE, decode(nvl(sp.dhs, 0), 0, 0, round(nvl(sq.rks, 0) / sp.dhs, 4)) ZB, (case sj.ISFLAG3 when 'Y' then '直送商品' when 'N' then '库存品' else '维护信息' end) ISFLAG3, sj.hsjj, decode(sj.ISGZ,'Y','是','否') ISGZ from (select b.gdseq, nvl(sum(b.dhs), 0) dhs, nvl(sum(b.hsje), 0) dhje from dat_dd_doc a, dat_dd_com b where a.seqno = b.seqno and a.flag in ('Y', 'G') and a.shrq between to_date('{0}', 'yyyy-mm-dd') and to_date('{1}', 'yyyy-mm-dd')+1 group by b.gdseq) sp, (select b.gdseq, nvl(sum(b.sssl), 0) rks, nvl(sum(b.hsje), 0) rkje from dat_rk_doc a, dat_rk_com b where a.seqno = b.seqno and a.flag in ('Y', 'G') and a.shrq between to_date('{0}', 'yyyy-mm-dd') and to_date('{1}', 'yyyy-mm-dd')+1 group by b.gdseq) sq, doc_goods sj where sp.gdseq = sq.gdseq(+) and sp.gdseq = sj.gdseq"; string strWhere = ""; if (!PubFunc.StrIsEmpty(ddlISGZ.SelectedValue)) { strWhere += " and sj.ISGZ = '" + ddlISGZ.SelectedValue + "'"; } if (!PubFunc.StrIsEmpty(txbGDSEQ.Text)) { strWhere += " and (sp.gdseq like '%" + txbGDSEQ.Text + "%' or sj.gdname like '%" + txbGDSEQ.Text + "%' or sj.zjm like '%" + txbGDSEQ.Text + "%')"; } if (strWhere.Trim().Length > 0) { strSql = strSql + strWhere; } strSql += " order by ZB"; //DataTable dtData = PubFunc.DbGetPage(GridGoods.PageIndex, GridGoods.PageSize, string.Format(strSql, dpkDATE1.Text, dpkDATE2.Text), ref total); //GridGoods.RecordCount = total; //GridGoods.DataSource = dtData; GridGoods.DataSource = DbHelperOra.QueryForTable(string.Format(strSql, dpkDATE1.Text, dpkDATE2.Text)); GridGoods.DataBind(); }
private void DataSearch() { int total = 0; DataTable dtData = PubFunc.DbGetPage(GridGoods.PageIndex, GridGoods.PageSize, GetSearchSql(), ref total); GridGoods.RecordCount = total; GridGoods.DataSource = dtData; GridGoods.DataBind(); //计算合计数量 if (dtData != null && dtData.Rows.Count > 0) { decimal QCKCSLTotal = 0, QCKCHSJETotal = 0, CGRKTotal = 0, CGRKHSJETotal = 0, KSTHTotal = 0, KSTHHSJETotal = 0, PYSLTotal = 0, PYHSJETotal = 0, DBRKTotal = 0, DBRKHSJETotal = 0, RKHJTotal = 0, RKHJHSJETotal = 0; decimal KFCKTotal = 0, KFCKHSJETotal = 0, THCKTotal = 0, THCKHSJETotal = 0, DBCKTotal = 0, DBCKHSJETotal = 0, CKHJTotal = 0, CKHJHSJETotal = 0, KCSLTotal = 0, KCHSJETotal = 0, TJJETotal = 0; decimal QMKCSLTotal = 0, QMKCHSJETotal = 0; foreach (DataRow row in dtData.Rows) { QCKCSLTotal += Convert.ToDecimal(row["QCKCSL"] ?? "0"); QCKCHSJETotal += Convert.ToDecimal(row["QCKCHSJE"] ?? "0"); QMKCSLTotal += Convert.ToDecimal(row["QMKCSL"] ?? "0"); QMKCHSJETotal += Convert.ToDecimal(row["QMKCHSJE"] ?? "0"); CGRKTotal += Convert.ToDecimal(row["CGRK"] ?? "0"); CGRKHSJETotal += Convert.ToDecimal(row["CGRKHSJE"] ?? "0"); KSTHTotal += Convert.ToDecimal(row["KSTH"] ?? "0"); KSTHHSJETotal += Convert.ToDecimal(row["KSTHHSJE"] ?? "0"); PYSLTotal += Convert.ToDecimal(row["PYSL"] ?? "0"); PYHSJETotal += Convert.ToDecimal(row["PYHSJE"] ?? "0"); DBRKTotal += Convert.ToDecimal(row["DBRK"] ?? "0"); DBRKHSJETotal += Convert.ToDecimal(row["DBRKHSJE"] ?? "0"); RKHJTotal += Convert.ToDecimal(row["RKHJ"] ?? "0"); RKHJHSJETotal += Convert.ToDecimal(row["RKHJHSJE"] ?? "0"); KFCKTotal += Convert.ToDecimal(row["KFCK"] ?? "0"); KFCKHSJETotal += Convert.ToDecimal(row["KFCKHSJE"] ?? "0"); THCKTotal += Convert.ToDecimal(row["THCK"] ?? "0"); THCKHSJETotal += Convert.ToDecimal(row["THCKHSJE"] ?? "0"); DBCKTotal += Convert.ToDecimal(row["DBCK"] ?? "0"); DBCKHSJETotal += Convert.ToDecimal(row["DBCKHSJE"] ?? "0"); CKHJTotal += Convert.ToDecimal(row["CKHJ"] ?? "0"); CKHJHSJETotal += Convert.ToDecimal(row["CKHJHSJE"] ?? "0"); KCSLTotal += Convert.ToDecimal(row["KCSL"] ?? "0"); KCHSJETotal += Convert.ToDecimal(row["KCHSJE"] ?? "0"); TJJETotal += Convert.ToDecimal(row["TJJE"] ?? "0"); } JObject summary = new JObject(); summary.Add("GDNAME", "本页合计"); summary.Add("QCKCSL", QCKCSLTotal); summary.Add("QCKCHSJE", QCKCHSJETotal.ToString("F2")); summary.Add("QMKCSL", QMKCSLTotal); summary.Add("QMKCHSJE", QMKCHSJETotal.ToString("F2")); summary.Add("CGRK", CGRKTotal); summary.Add("CGRKHSJE", CGRKHSJETotal.ToString("F2")); summary.Add("KSTH", KSTHTotal); summary.Add("KSTHHSJE", KSTHHSJETotal.ToString("F2")); summary.Add("PYSL", PYSLTotal); summary.Add("PYHSJE", PYHSJETotal.ToString("F2")); summary.Add("DBRK", DBRKTotal); summary.Add("DBRKHSJE", DBRKHSJETotal.ToString("F2")); summary.Add("RKHJ", RKHJTotal); summary.Add("RKHJHSJE", RKHJHSJETotal.ToString("F2")); summary.Add("KFCK", KFCKTotal); summary.Add("KFCKHSJE", KFCKHSJETotal.ToString("F2")); summary.Add("THCK", THCKTotal); summary.Add("THCKHSJE", THCKHSJETotal.ToString("F2")); summary.Add("DBCK", DBCKTotal); summary.Add("DBCKHSJE", DBCKHSJETotal.ToString("F2")); summary.Add("CKHJ", CKHJTotal); summary.Add("CKHJHSJE", CKHJHSJETotal.ToString("F2")); summary.Add("KCSL", KCSLTotal); summary.Add("KCHSJE", KCHSJETotal.ToString("F2")); summary.Add("TJJE", TJJETotal); GridGoods.SummaryData = summary; } }
protected override void billOpen(string strBillno) { DataTable dtDoc = DbHelperOra.Query(string.Format(strDocSql, strBillno)).Tables[0]; PubFunc.FormDataSet(FormDoc, dtDoc.Rows[0]); PageContext.RegisterStartupScript(GridGoods.GetRejectChangesReference()); DataTable dtBill = DbHelperOra.Query(string.Format(strComSql, strBillno)).Tables[0]; GridGoods.DataSource = dtBill; GridGoods.DataBind(); PubFunc.FormLock(FormDoc, true, ""); TabStrip1.ActiveTabIndex = 1; //屏蔽不需要的操作按钮 if (ddlFLAG.SelectedValue == "N") { btnTJ.Enabled = false; btnAddRow.Enabled = false; btnUpdate.Enabled = false; btnDelect.Enabled = false; btnDelRow.Enabled = false; btnSave.Enabled = false; btnPrint.Enabled = true; btnCancel.Enabled = true; btnAudit.Enabled = true; btnGoods.Enabled = false; btnDel.Enabled = false; } if (ddlFLAG.SelectedValue == "R") { btnAddRow.Enabled = false; btnUpdate.Enabled = false; btnDelect.Enabled = false; btnDelRow.Enabled = false; btnSave.Enabled = false; btnPrint.Enabled = true; btnCancel.Enabled = true; btnAudit.Enabled = false; btnGoods.Enabled = true; string flag = DbHelperOra.GetSingle("select XGTYPE from DAT_TZSUP_DOC t where t.billno='" + strBillno + "'").ToString(); if (flag == "N") { btnAddRow.Enabled = true; } else if (flag == "M") { btnUpdate.Enabled = true; } else if (flag == "D") { btnDelect.Enabled = true; } btnDelRow.Enabled = true; btnSave.Enabled = true; btnCancel.Enabled = false; btnDel.Enabled = true; } if (ddlFLAG.SelectedValue == "M") { btnAddRow.Enabled = false; btnUpdate.Enabled = false; btnDelect.Enabled = false; btnTJ.Enabled = true; btnGoods.Enabled = true; string flag = DbHelperOra.GetSingle("select XGTYPE from DAT_TZSUP_DOC t where t.billno='" + strBillno + "'").ToString(); if (flag == "N") { btnAddRow.Enabled = true; } else if (flag == "M") { btnUpdate.Enabled = true; } else if (flag == "D") { btnDelect.Enabled = true; } btnDelRow.Enabled = true; btnSave.Enabled = true; btnDel.Enabled = true; } else if (ddlFLAG.SelectedValue == "Y") { btnAddRow.Enabled = false; btnUpdate.Enabled = false; btnDelect.Enabled = false; btnDelRow.Enabled = false; btnSave.Enabled = false; btnTJ.Enabled = false; btnAudit.Enabled = false; btnPrint.Enabled = true; btnCancel.Enabled = false; btnUpdate.Enabled = false; btnDelect.Enabled = false; btnGoods.Enabled = false; btnDel.Enabled = false; } }