Ejemplo n.º 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.TMCASE GetModel(string OURNO)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select WITHDREW,CLIENT,CLIENT_NUMBER,RECEIVED,FILING_DATE,PRIORITY,CERT_FILED,APPLICATION_NO,AM_RCVD,AM_FILED,AM_REFUSAL_RCVD,AM_RW_CON_NATURE,OA_RCVD,OA_FILED,OA_REFUSAL_RCVD,OA_REFUSAL_EXT,OA_RW_FILED,OA_RW_CON_RCVD,OA_RW_CON_NATURE,PRE_PUBLISHED,OP_RCVD,OP_FILED,OP_CON_RCVD,OP_CON_NATURE,OP_RW_FILED,OP_RW_CON_RCVD,OP_RW_CON_NATURE,CERTIFICATION,DISP_RCVD,DISP_FILED,DISP_CON_RCVD,DISP_CON_NATURE,UNDER_LITIGATION,AGENT,OURNO,OP_CON_EXT,CLIENT2,CLIENT3,CLIENT4,CLIENT5,APPL_CODE1,APPL_CODE2,APPL_CODE3,DIARY,STATUSMARKS,BASICINFO from TMCASE ");
            strSql.Append(" where OURNO=:OURNO ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":OURNO", OracleType.VarChar, 18)
            };
            parameters[0].Value = OURNO;

            Model.TMCASE model = new Model.TMCASE();
            DataSet      ds    = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.BILL GetModel(string NOTENUMBER)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select CASENO,NOTENUMBER,ISSUENUMBER,TYPE,ISSUED,PAID,STATUS,COMMENTS,ADDRESS,CLIENT,OWNER,CURRENCYID,ACCOUNTID,BILLING_START_DATE,BILLING_END_DATE,FIRMID,CLIENT_MATTERID,SIGS,DESCLINE from BILL ");
            strSql.Append(" where NOTENUMBER=:NOTENUMBER ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":NOTENUMBER", OracleType.VarChar, 23)
            };
            parameters[0].Value = NOTENUMBER;

            Model.BILL model = new Model.BILL();
            DataSet    ds    = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.DROPPING_PATENTBILLINPUT GetModel(string PID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select PID,NOTENUMBER,TYPE,TEXT,QUANTITY,OFFICIALFEE,OTHERFEE,WAIVE from DROPPING_PATENTBILLINPUT ");
            strSql.Append(" where PID=:PID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":PID", OracleType.VarChar, 30)
            };
            parameters[0].Value = PID;

            Model.DROPPING_PATENTBILLINPUT model = new Model.DROPPING_PATENTBILLINPUT();
            DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public DB.Model.TASK GetModel(string TASK_GUID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select TASK_GUID,FILE_FULLNAME,ORDERED,PRINTING_TIME,SAVE_PATH,PRINTER,PAPER,ISPRINTING from TASK ");
            strSql.Append(" where TASK_GUID=:TASK_GUID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":TASK_GUID", OracleType.VarChar, 100)
            };
            parameters[0].Value = TASK_GUID;

            DB.Model.TASK model = new DB.Model.TASK();
            DataSet       ds    = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public STBC.Model.ST_USERS GetModel(decimal USERID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select USERID,USERNAME,USERSEX,LEVELNAME,USERTRADE,USERCOMPANY,USERPOSITION,USERRESEARCH_FIELDS,PSW,PHOTO from ST_USERS ");
            strSql.Append(" where USERID=:USERID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":USERID", OracleDbType.Int32, 22)
            };
            parameters[0].Value = USERID;

            STBC.Model.ST_USERS model = new STBC.Model.ST_USERS();
            DataSet             ds    = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.COUNTRY_TRANSLATION GetModel(string NAME)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select NAME,CNAME from COUNTRY_TRANSLATION ");
            strSql.Append(" where NAME=:NAME ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":NAME", OracleType.VarChar, 30)
            };
            parameters[0].Value = NAME;

            Model.COUNTRY_TRANSLATION model = new Model.COUNTRY_TRANSLATION();
            DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 8
0
        //换证
        protected void btnChange_Click(object sender, EventArgs e)
        {
            //授权换证提供商品更改,新的授权开始日期及截止日期。目前思路是授权和被授权机构置灰不允许在换证的时候进行更改
            chkisLR.Enabled   = false;
            chknoLR.Enabled   = false;
            trgSUPID1.Enabled = false;
            trgAGENT.Enabled  = false;
            dpkBEGRQ.Text     = "";
            dpkENDRQ.Text     = "";
            tbxDOCID.Text     = "";
            tbxMEMO.Text      = "";
            tbxSQREGION.Text  = "";
            isChange.Text     = "Y";
            btnSave.Enabled   = true;
            btnSumbit.Enabled = true;
            DataTable dtt      = DbHelperOra.Query(@"SELECT PRODUCER,F_GETSUPNAME(PRODUCER)PRODUCERNAME,SUPID,F_GETSUPNAME(SUPID)SUPNAME,SUPTOID,F_GETSUPNAME(SUPTOID)SUPTONAME,FLAG,SQREGION,BEGINSQRQ,ENDSQRQ,
                                                DECODE(FLAG,'N','已保存','S','已提交','Y','已审批','R','已驳回') FLAGNAME,DOCID,SUPAGENT,GOODSINDEX,F_GETSUPNAME(SUPAGENT)SUPAGENTNAME,MEMO,SQTYPE FROM DOC_LICENSE_GRANT T WHERE GRANTID='" + hfdGrantid.Text + "' AND SUPTOID='" + hfdbesup.Text + "'").Tables[0];
            string    producer = dtt.Rows[0]["PRODUCER"].ToString();
            string    prosql   = string.Format(@"SELECT GDSEQ,GDNAME,GDSPEC,F_GETSUPNAME(PRODUCER) PRODUCER FROM DOC_GOODS WHERE PRODUCER='{0}'", producer);
            DataTable prodt    = DbHelperOra.Query(prosql).Tables[0];

            GridList.DataSource = prodt;
            GridList.DataBind();
        }
Ejemplo n.º 9
0
        protected void btnSearch1_Click(object sender, EventArgs e)
        {
            if (dpkBegRQ.SelectedDate == null || dpkEndRQ.SelectedDate == null)
            {
                Alert.Show("请输入条件【查询期间】!");
                return;
            }
            else if (dpkBegRQ.SelectedDate > dpkEndRQ.SelectedDate)
            {
                Alert.Show("开始日期大于结束日期,请重新输入!");
                return;
            }

            if (docDHLX1.SelectedValue.Length < 1)
            {
                Alert.Show("请选择转商品类型!", MessageBoxIcon.Warning);
                return;
            }
            DataTable dtData = DbHelperOra.Query(GetSearchSql1()).Tables[0];

            OutputSummaryData1(dtData);
            GridCom.DataSource = dtData;
            GridCom.DataBind();
        }
Ejemplo n.º 10
0
        public DataSet GetQXList(string jsbm, string qxType, string _dwbm, string _bmbm, string key)
        {
            string        strWhere = " JSBM=:JSBM AND QXLX=:QXLX AND trim(DWBM)=:DWBM AND BMBM=:BMBM";
            StringBuilder strSql   = new StringBuilder();

            strSql.Append("select distinct QXBM,QXMC,JSBM,QXLX ");
            strSql.Append(" FROM XT_DM_QX ");
            strSql.Append(ConfigHelper.GetConfigString("OrcDBLinq"));
            strSql.Append(" where 1=1 AND " + strWhere);
            object[] objValues = new object[4];
            objValues[0] = jsbm.Trim();
            objValues[1] = qxType;
            objValues[2] = _dwbm.Trim();
            objValues[3] = _bmbm.Trim();
            try
            {
                return(DbHelperOra.Query(strSql.ToString(), ParameterHelp.ParameterReset(strWhere, objValues)));
            }
            catch (Exception ex)
            {
                EDRS.Common.LogHelper.LogError(this.context, "Exception", ex.Message, "public DataSet GetQXList(string jsbm, string qxType, string _dwbm, string _bmbm)", "EDRS.OracleDAL.XT_DM_QX", strSql.ToString(), ParameterHelp.ParameterReset(strWhere, objValues));
            }
            return(null);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public DB.Model.PAPER_SIZE GetModel(string PAPER_NAME)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select GUID,PAPER_NAME,PAPER_LENGTH,PAPER_WIDTH,PAPER_PIXEL_LENGTH,PAPER_PIXEL_WIDTH from PAPER_SIZE ");
            strSql.Append(" where PAPER_NAME=:PAPER_NAME ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":PAPER_NAME", OracleType.VarChar, 100)
            };
            parameters[0].Value = PAPER_NAME;

            DB.Model.PAPER_SIZE model = new DB.Model.PAPER_SIZE();
            DataSet             ds    = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.FLFEETYPE GetModel(string TYPENAME)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select TYPENAME,TYPEGROUP from FLFEETYPE ");
            strSql.Append(" where TYPENAME=:TYPENAME ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":TYPENAME", OracleType.VarChar, 30)
            };
            parameters[0].Value = TYPENAME;

            Model.FLFEETYPE model = new Model.FLFEETYPE();
            DataSet         ds    = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public STBC.Model.ST_CONSTRCONDIT GetModel(decimal ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,FACTID,UNIT,SYMBOLTYPE,LIMCONDIT,FACTTYPE,MEASNAME,USERID from ST_CONSTRCONDIT ");
            strSql.Append(" where ID=:ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":ID", OracleDbType.Int32, 22)
            };
            parameters[0].Value = ID;

            STBC.Model.ST_CONSTRCONDIT model = new STBC.Model.ST_CONSTRCONDIT();
            DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.HEADERMAPPINGTB GetModel(string ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,EXPRESSION,TABLENAME,TYPE,DATA_TYPE,NULLABLE,HEADING,REPORTCOL,FORMATTER from HEADERMAPPINGTB ");
            strSql.Append(" where ID=:ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":ID", OracleType.VarChar, 40)
            };
            parameters[0].Value = ID;

            Model.HEADERMAPPINGTB model = new Model.HEADERMAPPINGTB();
            DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.FCASE_WORKLOAD GetModel(string PID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select PID,OURNO,ITEM,AGENT,UNIT,AMOUNT,LANGUAGE,COMPLETEDATE,ISSUE from FCASE_WORKLOAD ");
            strSql.Append(" where PID=:PID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":PID", OracleType.VarChar, 20)
            };
            parameters[0].Value = PID;

            Model.FCASE_WORKLOAD model = new Model.FCASE_WORKLOAD();
            DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.EX_HKCASE GetModel(string HK_APP_REF)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select HK_APP_REF,HK_APP_NO,HK_PUB_NO,HK_REG1_DATE,HK_PUB1_DATE,MAINTENANCE_DUEDATE,HK_REG2_DATE,NEXT_RENEWAL_DUEDATE,CN_APP_REF,CN_APP_NO,CN_APP_DATE,P4_SENDING_DATE,FIRST_AGENCY_REPORT,TO_PUB,P5_SENDING_DATE,SECOND_AGENCY_REPORT,TO_GRANT,COMMENTS,CLIENT_REF,CLIENT,HK_ANNO_NO,HK_GAZETTE,PARENT_COUNTRY,RECEIVED,ABANDON,PRIORITY,SENDADDRESS,ADDRCHECK,APPLICANT from EX_HKCASE ");
            strSql.Append(" where HK_APP_REF=:HK_APP_REF ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":HK_APP_REF", OracleType.VarChar, 30)
            };
            parameters[0].Value = HK_APP_REF;

            Model.EX_HKCASE model = new Model.EX_HKCASE();
            DataSet         ds    = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 17
0
        protected void btExp_Click(object sender, EventArgs e)
        {
            if (GridProducer.Rows.Count < 1)
            {
                Alert.Show("没有数据,无法导出!");
                return;
            }

            string query = "%";

            if (!string.IsNullOrWhiteSpace(trbSearch.Text))
            {
                query = trbSearch.Text.Trim();
            }
            string sql = string.Format(@"select CODE 生产商编码, NAME 生产商名称, TEL 公司电话, LINKMAN 联系人, LOGINADDR 注册地址
                                          from DOC_PRODUCER
                                         WHERE CODE like '%{0}%'
                                            or NAME like '%{0}%'
                                        ", query);

            DataTable dt = DbHelperOra.Query(sql).Tables[0];

            ExcelHelper.ExportByWeb(dt, "生产商资料导出", "生产商资料导出_" + DateTime.Now.ToString("yyyyMMddHH") + ".xls");
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.PATENTBILLITEMTYPE_V2 GetModel(string BILLCODE)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select BILLCODE,BILLTEXT,PATENTCASETYPE,HASQUANTITY,UNIT,DEFOFFICIALFEE,DEFNONOFFICIALFEE,ALGORITHM,F0,F1,F2,F3,F4,F5,COMMENTS from PATENTBILLITEMTYPE_V2 ");
            strSql.Append(" where BILLCODE=:BILLCODE ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":BILLCODE", OracleType.VarChar, 30)
            };
            parameters[0].Value = BILLCODE;

            Model.PATENTBILLITEMTYPE_V2 model = new Model.PATENTBILLITEMTYPE_V2();
            DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.FCASE_PRIORITY GetModel(string PID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select PID,OURNO,PRIOR_DATE,PRIOR_NUM,PRIOR_COUNTRY from FCASE_PRIORITY ");
            strSql.Append(" where PID=:PID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":PID", OracleType.VarChar, 20)
            };
            parameters[0].Value = PID;

            Model.FCASE_PRIORITY model = new Model.FCASE_PRIORITY();
            DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.CLIENTDB GetModel(string CLIENTID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select CLIENTID,CLIENTNAME,CLIENTCNAME,PT_APPN_COPY,PT_BILL_COPY,MAILING_ADDR,MAILING_CONTACT,BILLING_CONTACT,PT_GENERAL_INSTR,BILLALIAS from CLIENTDB ");
            strSql.Append(" where CLIENTID=:CLIENTID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":CLIENTID", OracleType.Char, 4)
            };
            parameters[0].Value = CLIENTID;

            Model.CLIENTDB model = new Model.CLIENTDB();
            DataSet        ds    = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 21
0
        protected void bind()
        {
            String Sql   = @"SELECT f_getdeptname(A.DEPTID) DEPTIDNAME,A.GDSEQ,A.SL,A.PH,A.RQ_SC,A.YXQZ,A.MEMO,
                                       NVL(B.HISNAME,B.GDNAME) GDNAME,B.GDSPEC,f_getunitname(B.UNIT) UNITNAME,f_getproducername(A.STR1) PRODUCERNAME,f_getproducername(A.SUPPLIER) SUPPLIERNAME,
                                       B.PIZNO,B.HSJJ,A.FLAG
                                FROM DAT_STOCK_IMP A, DOC_GOODS B
                                WHERE A.GDSEQ = B.GDSEQ(+) AND A.LRY = '{0}' ORDER BY A.FLAG";
            int    total = 0;

            GridStock.DataSource = DbHelperOra.Query(String.Format(Sql, UserAction.UserID)).Tables[0];
            DataTable dtData = PubFunc.DbGetPage(GridStock.PageIndex, GridStock.PageSize, String.Format(Sql, UserAction.UserID), ref total);

            GridStock.RecordCount = total;
            GridStock.DataSource  = dtData;
            GridStock.DataBind();
            if (dtData.Rows.Count > 0)
            {
                btnSave.Enabled = true;
            }
            else
            {
                btnSave.Enabled = false;
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public EDRS.Model.YX_DZJZ_FMDYMB GetModel(string BM)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select BM,BT,SFMR,CZRGH,CZR,CZSJ,CZIP,SFSC,NR from YX_DZJZ_FMDYMB ");
            strSql.Append(" where BM=:BM ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":BM", OracleType.NVarChar)
            };
            parameters[0].Value = BM;

            EDRS.Model.YX_DZJZ_FMDYMB model = new EDRS.Model.YX_DZJZ_FMDYMB();
            DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 23
0
        public DataSet CheckConfigSql(string sql, List <ConfigToSqlParameter> para, string serverType, string userorgcode, out string result)
        {
            result = "语法验证通过,数据验证请下载文件。";
            string   sqlText = "";
            DateTime dt      = DateTime.Now.AddDays(-1);
            int      i       = 0;

            if (sql != "")
            {
                #region
                if (serverType == "sql")
                {
                    if (para.Count > 0)
                    {
                        foreach (ConfigToSqlParameter item in para)
                        {
                            if (i == 0)
                            {
                                sqlText = sql.Replace(item.ParameterName, "'" + dt.ToString() + "'");
                                sql     = sqlText;
                            }
                            else
                            {
                                sqlText = sql.Replace(item.ParameterName, "'" + dt.ToString() + "'");
                                sql     = sqlText;
                            }
                        }
                    }
                }
                else
                {
                    if (para.Count > 0)
                    {
                        foreach (ConfigToSqlParameter item in para)
                        {
                            string dtstr  = dt.ToString("yyyy-MM-dd HH:mm:ss");
                            string values = "to_date('" + dtstr + "','yyyy-mm-dd hh24:mi:ss')";

                            if (i == 0)
                            {
                                sqlText = sql.Replace(item.ParameterName, values);
                                sql     = sqlText;
                            }
                            else
                            {
                                sqlText = sql.Replace(item.ParameterName, values);
                                sql     = sqlText;
                            }
                        }
                    }
                }
                #endregion
            }
            DataSet ExcelDs = new DataSet();

            try
            {
                if (serverType == "sql")
                {
                    ExcelDs = DbHelperSQL.SqlQuery(sql.ToString());
                }
                else if (serverType == "oracle")
                {
                    string sql1 = sql.ToLower();
                    if (sql1.Contains("ddicode"))
                    {
                        using (DbHelperOra _ora = new DbHelperOra(ConnName))
                        {
                            ExcelDs = _ora.Query(sql.ToString());
                        }
                    }
                    else
                    {
                        result = "Query 语句必须包含 DDI查询码!";
                    }
                }
            }
            catch (Exception ex)
            {
                result = "Query 语句存在语法错误:" + ex.Message.ToString();
            }



            return(ExcelDs);
        }
Ejemplo n.º 24
0
        protected override void billOpen(string strBillno)
        {
            DataTable dtDoc = DbHelperOra.Query(string.Format(strDocSql, strBillno)).Tables[0];

            if (dtDoc != null && dtDoc.Rows.Count > 0)
            {
                PubFunc.FormDataSet(FormDoc, dtDoc.Rows[0]);
            }
            else
            {
                Alert.Show("单据信息获取失败!!!", "警告提示", MessageBoxIcon.Warning);
                return;
            }

            PageContext.RegisterStartupScript(GridGoods.GetRejectChangesReference());
            DataTable dtBill = DbHelperOra.Query(string.Format(strComSql, strBillno)).Tables[0];
            decimal   bzslTotal = 0, feeTotal = 0;

            if (dtBill != null && dtBill.Rows.Count > 0)
            {
                foreach (DataRow row in dtBill.Rows)
                {
                    bzslTotal += Convert.ToDecimal(row["YSSL"] ?? "0");
                    feeTotal  += Convert.ToDecimal(row["YSSL"] ?? "0") * Convert.ToDecimal(row["HSJJ"] ?? "0");
                }
                Doc.GridRowAdd(GridGoods, dtBill);
            }

            //增加合计
            JObject summary = new JObject();

            summary.Add("GDNAME", "本页合计");
            summary.Add("YSSL", bzslTotal.ToString());
            summary.Add("HSJE", feeTotal.ToString("F2"));
            GridGoods.SummaryData = summary;
            PubFunc.FormLock(FormDoc, true, "");
            TabStrip1.ActiveTabIndex = 1;
            //按钮状态转换
            if (docFLAG.SelectedValue == "N")
            {
                //提交
                btnNew.Enabled      = true;
                btnGenerate.Enabled = false;
                btnSave.Enabled     = false;
                btnSumbit.Enabled   = false;
                btnAudit.Enabled    = true;
                btnCancel.Enabled   = true;
                btnPrint.Enabled    = true;
                btnExport.Enabled   = true;
                btnDelRow.Enabled   = false;
            }
            else if (docFLAG.SelectedValue.Equals("R"))
            {
                btnSave.Enabled     = true;
                btnSumbit.Enabled   = true;
                btnDelRow.Enabled   = true;
                btnGenerate.Enabled = false;
                //   dpkRQSJ1.Enabled = true;
                //  dpkRQSJ2.Enabled = true;
                // ddlDEPTID.Enabled = true;
                // nbxYSSL.Enabled = true;
                docMEMO.Enabled = true;
            }
            else if (docFLAG.SelectedValue.Equals("M"))
            {
                btnSave.Enabled     = true;
                btnSumbit.Enabled   = true;
                btnDelRow.Enabled   = true;
                btnGenerate.Enabled = false;
                btnExport.Enabled   = false;
                btnPrint.Enabled    = false;
                btnCancel.Enabled   = false;
                btnAudit.Enabled    = false;
                //   dpkRQSJ1.Enabled = true;
                //  dpkRQSJ2.Enabled = true;
                //   ddlDEPTID.Enabled = true;
                //  nbxYSSL.Enabled = true;
                docMEMO.Enabled = true;
            }
            else
            {
                //审核
                btnNew.Enabled      = true;
                btnGenerate.Enabled = false;
                btnSave.Enabled     = false;
                btnSumbit.Enabled   = false;
                btnAudit.Enabled    = false;
                btnPrint.Enabled    = true;
                btnExport.Enabled   = true;
                btnDelRow.Enabled   = false;
            }
        }
Ejemplo n.º 25
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            if (GridList.Rows.Count < 1)
            {
                Alert.Show("没有数据,无法导出!");
                return;
            }

            string strSql         = @"select 
                              f_getdeptname(A.DEPTID) 科室库房,
                              ' '||A.GDSEQ 商品编码,
                              F_GETHISINFO(A.GDSEQ, 'GDNAME') 商品名称,
                              F_GETHISINFO(A.GDSEQ, 'GDSPEC') 商品规格,
                              f_getunitname(A.UNIT) 单位,
                              A.KCSL 数量,
                              B.HSJJ 单价,
                              A.HWID 货位,
                              f_getproducername(B.PRODUCER) 生产商,
                              A.PHID 批号,
                              B.PIZNO 注册证号,
                              TO_CHAR(A.RQ_SC, 'YYYY-MM-DD') 生产日期,
                              TO_CHAR(A.YXQZ, 'YYYY-MM-DD') 有效期至,
                              ceil(A.YXQZ - SYSDATE) 剩余天数,
                              decode(B.ISGZ,'Y','是','否') 是否高值
                          from (SELECT * FROM DAT_GOODSSTOCK WHERE F_CHK_DATARANGE(DEPTID, '" + UserAction.UserID + @"') = 'Y') A, DOC_GOODS B
                         where A.GDSEQ = B.GDSEQ
                           AND A.KCSL > 0";
            string strSearch      = "";
            string strSearchOrder = " order by (ceil(A.YXQZ-SYSDATE)) ASC";

            if (!PubFunc.StrIsEmpty(ddlISGZ.SelectedValue))
            {
                strSearch += " and B.ISGZ = '" + ddlISGZ.SelectedValue + "'";
            }
            if (tgbGDSEQ.Text.Trim().Length > 0)
            {
                strSearch += string.Format(" AND (A.GDSEQ   LIKE '%{0}%' OR B.GDNAME LIKE '%{0}%') ", tgbGDSEQ.Text.Trim());
            }
            if (lstDEPTID.SelectedItem != null && lstDEPTID.SelectedIndex > 0)
            {
                strSearch += string.Format(" AND A.DEPTID='{0}'", lstDEPTID.SelectedItem.Value);
            }
            if (dqsj.Text.Trim() == "")
            {
                dqsj.Text = "0";
            }
            else
            {
                strSearch += string.Format(" AND ceil(A.YXQZ-SYSDATE) <='{0}'", dqsj.Text.Trim());
            }
            if (ShowMode.Checked == false)
            {
                strSearch += " AND ceil(A.YXQZ-SYSDATE) >= 0 ";
            }

            strSql += strSearch;
            strSql += strSearchOrder;

            DataTable dt = DbHelperOra.Query(strSql).Tables[0];

            ExcelHelper.ExportByWeb(dt, "近效期库存导出", "近效期库存导出_" + DateTime.Now.ToString("yyyyMMddHH") + ".xls");
        }
Ejemplo n.º 26
0
        protected override void billSearch()
        {
            // modify by zhanghaicheng  201509191553

            /*  if (string.IsNullOrWhiteSpace(dpkRQSJ1.SelectedDate.ToString()) && string.IsNullOrWhiteSpace(dpkRQSJ1.SelectedDate.ToString()))
             * {
             *    Alert.Show("【开始日期】和【结束日期】都不得为空", "操作提示", MessageBoxIcon.Information);
             *    return;
             * }
             * else if (dpkRQSJ1.SelectedDate > dpkRQSJ2.SelectedDate)
             * {
             *    Alert.Show("【开始日期】大于【结束日期】,请重新输入!", "操作提示", MessageBoxIcon.Information);
             *    return;
             * }
             * if (string.IsNullOrWhiteSpace(docYSRQ.Text))
             * {
             *    Alert.Show("【预算月份】不得为空!", "操作提示", MessageBoxIcon.Information);
             *    return;
             * }
             * if (Convert.ToDateTime(docYSRQ.Text) < dpkRQSJ2.SelectedDate)
             * {
             *    Alert.Show("【预算月份】不能小于历史【结束月份】!!!", "操作月份", MessageBoxIcon.Information);
             * }
             */
            PageContext.RegisterStartupScript(GridGoods.GetRejectChangesReference());

            /*   string ACCOUNTDAY = Doc.DbGetSysPara("ACCOUNTDAY");
             * DateTime startDate = new DateTime();
             * DateTime endDate = new DateTime();
             * if (ACCOUNTDAY == "31")
             * {
             *    startDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy") + "-" + ddlMonth.SelectedValue.ToString() + "-01");
             *    endDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy") + "-" + ddlMonth.SelectedValue.ToString() + "-01").AddMonths(1);
             * }
             * else
             * {
             *    startDate = Convert.ToDateTime(DateTime.Now.AddMonths(-1).ToString("yyyy") + "-" + ddlMonth.SelectedValue.ToString() + "-" + ACCOUNTDAY);
             *    endDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy") + "-" + ddlMonth.SelectedValue.ToString() + "-" + ACCOUNTDAY);
             *
             * }*/

            //string strSql = @"select a.fd YSSL,a.sl XHSL,b.GDSEQ,b.HSJJ*a.fd HSJE,decode(b.FLAG,'Y','正常','T','停购','N','新品','E','淘汰') FLAG, b.GDNAME,b.GDSPEC,f_getunitname(b.UNIT) UNIT,b.CATID,b.PIZNO,F_GETPRODUCERNAME(b.PRODUCER) PRODUCER,b.HSJJ,b.HISCODE,b.HISNAME from (select t.gdseq, ";

            Int32 dayDiff = new TimeSpan(Convert.ToDateTime(dpEndDate.SelectedDate).Ticks - Convert.ToDateTime(dpStartDate.SelectedDate).Ticks).Days + 1;


            string strSql    = string.Format(@"SELECT B.GDSEQ,
                               B.GDNAME,
                               B.GDSPEC,
                               CEIL(NVL(A.FD, 0)) YSSL,
                               NVL(A.SL, 0) XHSL,
                               B.UNIT,
                               F_GETUNITNAME(B.UNIT) UNITNAME,
                               B.HSJJ,
                               B.HSJJ * CEIL(NVL(A.FD, 0)) HSJE,
                               B.PIZNO,
                               B.PRODUCER,
                               F_GETPRODUCERNAME(B.PRODUCER) PRODUCERNAME,
                               B.HISCODE,
                               B.HISNAME", dayDiff.ToString());
            string strSearch = "";

            strSearch += string.Format(@"  FROM (SELECT T.GDSEQ, ABS(SUM(T.SL)) SL,  CEIL(ABS(SUM(T.SL))*30 /{0}) * {1} FD FROM DAT_GOODSJXC T WHERE T.KCADD='-1'", dayDiff.ToString(), Convert.ToDecimal(nbxYSSL.Text));
            if (!string.IsNullOrWhiteSpace(ddlDEPTID.SelectedValue))
            {
                strSearch += string.Format(" AND T.DEPTID = '{0}' ", ddlDEPTID.SelectedValue);
            }
            strSearch += string.Format(" AND T.RQSJ>=TO_DATE('{0}','YYYY-MM-DD')", startDate.ToString("yyyy-MM-dd"));
            strSearch += string.Format(" AND T.RQSJ <TO_DATE('{0}','YYYY-MM-DD') + 1", endDate.ToString("yyyy-MM-dd"));
            strSearch += string.Format(@" GROUP BY T.GDSEQ) A,DOC_GOODS B,DOC_GOODSCFG C WHERE B.FLAG = 'Y'  AND B.GDSEQ = C.GDSEQ AND C.GDSEQ = A.GDSEQ(+)");
            strSearch += string.Format(" AND C.DEPTID = '{0}' ", ddlDEPTID.SelectedValue);
            if (!string.IsNullOrWhiteSpace(strSearch))
            {
                strSql += strSearch;
            }
            //int total = 0;
            DataTable billDT = new DataTable();

            billDT = DbHelperOra.Query(strSql).Tables[0];
            // GridGoods.DataBind();

            // billDT = GetDataTable(GridGoods.PageIndex, GridGoods.PageSize, strSql, ref total);
            Doc.GridRowAdd(GridGoods, billDT);
        }
Ejemplo n.º 27
0
        protected void btExport_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tbxMonth.Text))
            {
                Alert.Show("请选择[查询月份]!", MessageBoxIcon.Warning);
                return;
            }
            string   startTime  = string.Empty;
            string   endTime    = string.Empty;
            string   ACCOUNTDAY = Doc.DbGetSysPara("ACCOUNTDAY");
            DateTime startDate  = new DateTime();
            DateTime endDate    = new DateTime();

            if (ACCOUNTDAY == "31")
            {
                //startDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy") + "-" + ddlMonth.SelectedValue.ToString() + "-01");
                //endDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy") + "-" + ddlMonth.SelectedValue.ToString() + "-01").AddMonths(1).AddDays(-1);
                startDate = Convert.ToDateTime(tbxMonth.Text + "-01");
                endDate   = Convert.ToDateTime(tbxMonth.Text + "-01").AddMonths(1).AddDays(-1);
            }
            else
            {
                //startDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy") + "-" + ddlMonth.SelectedValue.ToString() + "-" + ACCOUNTDAY).AddMonths(-1);
                //endDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy") + "-" + ddlMonth.SelectedValue.ToString() + "-" + ACCOUNTDAY).AddDays(-1);
                startDate = Convert.ToDateTime(tbxMonth.Text + "-" + ACCOUNTDAY).AddMonths(-1);
                endDate   = Convert.ToDateTime(tbxMonth.Text + "-" + ACCOUNTDAY).AddDays(-1);
            }
            string strSql = string.Format(@"SELECT v.DEPTID 部门编码,
                                           f_GetDEPTNAME(v.DEPTID) 部门名称,
                                           SUM(YSJE) 预算金额,
                                           SUM(SJJE) 执行金额,
                                           ROUND(DECODE(SUM(NVL(SJJE, 0)),
                                                        0,
                                                        0,
                                                        sum(NVL(YSJE, 0)) / sum(NVL(SJJE, 0))),
                                                 4) 使用占比
                                      FROM (SELECT SA.DEPTID,
                                                   SD.GDSEQ,
                                                   SD.GdNAME,
                                                   SD.HSJJ,
                                                   SD.GDSPEC,
                                                   F_GETUNITNAME(SD.Unit) Unit,
                                                   F_GETPRODUCERNAME(SD.Producer) PRODUCTER,
                                                   NVL(SB.PDSL, 0) PDSL,
                                                   NVL(SB.PDJE, 0) PDJE,
                                                   NVL(SC.YSSL, 0) YSSL,
                                                   NVL(SC.YSJE, 0) YSJE,
                                                    NVL(F_GETXHSL(SA.DEPTID, SA.GDSEQ, '{0}', '{1}', '0'), 0) ERPSL,
                                                   NVL(F_GETXHSL(SA.DEPTID, SA.GDSEQ, '{0}', '{1}', '1'), 0) ERPJE,
                                                    F_GETKC(SA.DEPTID,SD.GDSEQ,'{1}') STOCKSL,
                                                   NVL((NVL(F_GETXHSL(SA.DEPTID, SA.GDSEQ, '{0}', '{1}', '0'), 0) -
                                                       NVL(SB.PDSL, 0) + F_GETKC(SA.DEPTID,SD.GDSEQ,'{1}')),
                                                       0) SJSL,
                                                   NVL((NVL(F_GETXHSL(SA.DEPTID, SA.GDSEQ, '{0}', '{1}', '0'), 0) -
                                                       NVL(SB.PDSL, 0) + F_GETKC(SA.DEPTID,SD.GDSEQ,'{1}')),
                                                       0) * SD.HSJJ SJJE
                                              FROM (SELECT DISTINCT DEPTID, GDSEQ
                                                      FROM (SELECT DEPTID, GDSEQ
                                                              FROM DAT_GOODSJXC A
                                                             WHERE RQSJ BETWEEN TO_DATE('{0}', 'YYYY-MM-DD') AND
                                                                   TO_DATE('{1}', 'YYYY-MM-DD') 
                                                               AND EXISTS (SELECT 1
                                                                      FROM SYS_DEPT
                                                                     WHERE TYPE = '3'
                                                                       AND CODE = A.DEPTID)
                                                            UNION
                                                            SELECT A.DEPTID, B.GDSEQ
                                                              FROM DAT_PD_DOC A, DAT_PD_COM B
                                                             WHERE A.SEQNO = B.SEQNO
                                                               AND A.PDTYPE = '3'
                                                               AND A.SHRQ BETWEEN TO_DATE('{0}', 'YYYY-MM-DD') AND
                                                                   TO_DATE('{1}', 'YYYY-MM-DD') 
                                                            UNION
                                                            SELECT A.DEPTID, B.GDSEQ
                                                              FROM DAT_YS_DOC A, DAT_YS_COM B
                                                             WHERE A.SEQNO = B.SEQNO
                                                               AND A.YSRQ BETWEEN TO_DATE('{0}', 'YYYY-MM-DD') AND
                                                                   TO_DATE('{1}', 'YYYY-MM-DD') )
                                                             UNION
                                                         (SELECT DEPTID, GDSEQ
                                                              FROM DAT_GOODSSTOCK
                                                             WHERE DEPTID IN (SELECT CODE FROM SYS_DEPT WHERE TYPE = '3'))) SA,
                                                   (SELECT A.DEPTID, B.GDSEQ, SUM(B.PDSL) PDSL, SUM(B.HSJE) PDJE
                                                      FROM DAT_PD_DOC A, DAT_PD_COM B
                                                     WHERE A.SEQNO = B.SEQNO
                                                       AND A.PDTYPE = '3'
                                                       AND A.SHRQ BETWEEN TO_DATE('{0}', 'YYYY-MM-DD') AND
                                                           TO_DATE('{1}', 'YYYY-MM-DD') 
                                                     GROUP BY A.DEPTID, B.GDSEQ) SB,
                                                   (SELECT A.DEPTID, B.GDSEQ, SUM(B.YSSL) YsSL, SUM(B.HSJE) YSJE
                                                      FROM DAT_YS_DOC A, DAT_YS_COM B
                                                     WHERE A.SEQNO = B.SEQNO
                                                       AND A.YSRQ BETWEEN TO_DATE('{0}', 'YYYY-MM-DD') AND
                                                           TO_DATE('{1}', 'YYYY-MM-DD') 
                                                     GROUP BY A.DEPTID, B.GDSEQ) SC,
                                                   DOC_GOODS SD,
                                                  (SELECT 
                                                 SUM(T.KCSL) STOCKSL,
                                                    T.DEPTID,
                                                    T.GDSEQ
                                      FROM DAT_STOCKDAY T
                                     WHERE NOT EXISTS
                                     (SELECT 1
                                              FROM DAT_STOCKDAY
                                             WHERE TO_CHAR(RQ, 'MM') = to_char(t.RQ, 'MM')
                                               AND RQ > t.RQ)
                  
                                       AND RQ BETWEEN TO_DATE('{0}', 'YYYY-MM-DD') AND
                                           TO_DATE('{1}', 'YYYY-MM-DD')  GROUP BY  T.DEPTID,
                                                    T.GDSEQ) SE
                                             WHERE SA.DEPTID = SB.DEPTID(+)
                                               AND SA.GDSEQ = SB.GDSEQ(+)
                                               AND SA.DEPTID = SC.DEPTID(+)
                                               AND SA.GDSEQ = SC.GDSEQ(+)
                                               AND SA.GDSEQ = SD.GDSEQ
                                               AND SA.DEPTID = SE.DEPTID(+)
                                               AND SA.GDSEQ = SE.GDSEQ(+)) v
                                     WHERE 1 = 1 ", startDate.ToString("yyyy -MM-dd"), endDate.ToString("yyyy-MM-dd"));

            //) v Group by DEPTID
            if (!string.IsNullOrEmpty(lstDEPTID.SelectedValue))
            {
                strSql += " AND v.deptid='" + lstDEPTID.SelectedValue + "'";
            }
            strSql += " Group by v.DEPTID  ";
            ExcelHelper.ExportByWeb(DbHelperOra.Query(strSql).Tables[0], "全院科室" + startDate.ToString("MM") + "月预算执行情况报告", string.Format("全院科室" + startDate.ToString("MM") + "月预算执行情况分析表_{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss")));
        }
Ejemplo n.º 28
0
 protected void GridToBrief_RowDoubleClick(object sender, FineUIPro.GridRowClickEventArgs e)
 {
     string    strcode = GridToBrief.Rows[e.RowIndex].Values[0].ToString();
     DataTable dt      = DbHelperOra.Query("select * from DOC_BRIEF_DOC where code='" + strcode + "'").Tables[0];
 }
Ejemplo n.º 29
0
        protected void btnBillSave_Click(object sender, EventArgs e)
        {
            if (GridBill.SelectedRowIndexArray.Length > 0)
            {
                string msg       = "";
                string strBillno = "";
                foreach (int index in GridBill.SelectedRowIndexArray)
                {
                    strBillno += GridBill.Rows[index].Values[0].ToString() + "','";
                }
                string    sql    = @"SELECT A.SEQNO,A.ROWNO,A.GDSEQ,A.BARCODE,A.GDNAME,A.UNIT,A.GDSPEC,A.GDMODE,'{1}' HWID,A.BZHL,A.BZSL,
                                      A.DHSL,A.XSSL,A.JXTAX,A.HSJJ,A.BHSJJ,A.HSJE,A.BHSJE,A.LSJ,A.LSJE,A.ISGZ,A.ISLOT,A.PHID,
                                      A.PZWH,A.PRODUCER,A.ZPBH,A.MEMO,F_GETUNITNAME(A.UNIT) UNITNAME,
                                      F_GETPRODUCERNAME(A.PRODUCER) PRODUCERNAME,
                                      '' ONECODE,
                                      '' STR1
                                 FROM DAT_CK_COM A, DAT_CK_DOC B,DOC_GOODS C 
                                WHERE A.SEQNO = B.SEQNO AND A.GDSEQ = C.GDSEQ AND A.SEQNO IN ('{0}') AND B.FLAG='Y' AND  c.ISGZ='N'
                                ORDER BY A.SEQNO DESC, A.ROWNO ASC";
                DataTable dtBill = DbHelperOra.Query(string.Format(sql, strBillno.TrimEnd(new char[] { '\'', ',' }), docDEPTID.SelectedValue)).Tables[0];
                dtBill.Columns.Add("PH", Type.GetType("System.String"));
                dtBill.Columns.Add("YXQZ", Type.GetType("System.String"));
                dtBill.Columns.Add("RQ_SC", Type.GetType("System.String"));
                dtBill.Columns.Add("KCSL", Type.GetType("System.String"));
                decimal bzslTotal = 0, feeTotal = 0;
                if (dtBill != null && dtBill.Rows.Count > 0)
                {
                    int rowIndex = 0;
                    foreach (DataRow row in dtBill.Rows)
                    {
                        if (row["ISGZ"].ToString() == "Y")
                        {
                            msg += "【" + row["GDSEQ"].ToString() + " | " + row["GDNAME"].ToString() + "】,";
                            continue;
                        }

                        rowIndex++;
                        row["ROWNO"] = rowIndex;
                        row["KCSL"]  = "0";
                        DataTable Temp = DbHelperOra.Query(string.Format("SELECT A.HWID,A.KCSL,A.PH,A.YXQZ,A.RQ_SC,B.ISGZ,B.GDNAME FROM DAT_GOODSSTOCK A ,DOC_GOODS B WHERE A.DEPTID ='{0}' AND A.GDSEQ = '{1}'  AND A.GDSEQ = B.GDSEQ AND A.KCSL >0 AND ROWNUM = 1 ORDER BY A.YXQZ ASC", docDEPTID.SelectedValue, row["GDSEQ"].ToString())).Tables[0];
                        if (Temp.Rows.Count > 0)
                        {
                            row["KCSL"]  = Temp.Rows[0]["KCSL"];
                            row["PH"]    = Temp.Rows[0]["PH"];
                            row["YXQZ"]  = Temp.Rows[0]["YXQZ"];
                            row["RQ_SC"] = Temp.Rows[0]["RQ_SC"];
                        }

                        bzslTotal += Convert.ToDecimal(row["BZSL"]);
                        feeTotal  += Convert.ToDecimal(row["BZSL"]) * Convert.ToDecimal(row["HSJJ"]);
                        LoadGridRow(row, false, "OLD");
                    }

                    //增加合计
                    JObject summary = new JObject();
                    summary.Add("GDNAME", "本页合计");
                    summary.Add("BZSL", bzslTotal.ToString());
                    summary.Add("HSJE", feeTotal.ToString("F2"));
                    GridGoods.SummaryData = summary;
                }

                if (!string.IsNullOrWhiteSpace(msg))
                {
                    Alert.Show("商品" + msg + ",是高值商品,请到【高值商品使用】录入");
                    return;
                }
            }
            WindowBill.Hidden = true;
        }
Ejemplo n.º 30
0
        protected void tbxBARCODE_TextChanged(object sender, EventArgs e)
        {
            int len = Doc.LENCODE();

            if (tbxBARCODE.Text.Trim().Length < len)
            {
                return;
            }
            DataTable dtCode = DbHelperOra.Query(string.Format("SELECT * FROM DAT_CK_BARCODE WHERE BARCODE = '{0}'", tbxBARCODE.Text)).Tables[0];

            if (dtCode == null || dtCode.Rows.Count != 1)
            {
                Alert.Show("条码信息错误,请检查!!!", "异常提示", MessageBoxIcon.Warning);
                return;
            }
            if (dtCode.Rows[0]["FLAG"].ToString() != "N")
            {
                Alert.Show("您扫描的条码状态不是【未使用】,请检查!!!", "异常提示", MessageBoxIcon.Warning);
                return;
            }
            string deptid = dtCode.Rows[0]["DEPTIN"].ToString();

            if (docDEPTID.SelectedValue == "")
            {
                docDEPTID.SelectedValue = deptid;
            }
            else
            {
                if (docDEPTID.SelectedValue != deptid)
                {
                    Alert.Show("扫描条码非[" + docDEPTID.SelectedText + "]科室条码,请检查!", "操作提示", MessageBoxIcon.Warning);
                    tbxBARCODE.Text = "";
                    tbxBARCODE.Focus();
                    return;
                }
            }

            if (tbxBARCODE.Text.Substring(0, 1) != "0")
            {
                //增加定数条码提示
                if (tbxBARCODE.Text.Substring(0, 1) == "1")
                {
                    Alert.Show("扫描定数条码为定数条码,请到【使定数条码回收】界面录入!", "异常提示", MessageBoxIcon.Warning);
                }
                else
                {
                    Alert.Show(string.Format("条码【{0}】不是非定数条码,不能在本页面进行回收扫描!", tbxBARCODE.Text), "异常提示", MessageBoxIcon.Warning);
                }
                tbxBARCODE.Text = "";
                tbxBARCODE.Focus();
                return;
            }

            //重新取得数量
            DataTable barcode = DbHelperOra.Query("select A.*,B.PIZNO,F_GETUNITNAME(B.UNIT)UNITSMALLNAME from dat_ck_barcode A,DOC_GOODS B where A.GDSEQ = B.GDSEQ AND B.FLAG IN('Y','T') AND A.BARCODE = '" + tbxBARCODE.Text + "' and A.FLAG = 'N'").Tables[0];

            if (barcode.Rows.Count < 1)
            {
                Alert.Show("扫描条码不存在或已经被回收请检查!");
                tbxBARCODE.Text = "";
                tbxBARCODE.Focus();
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().ToList();

            for (int i = 0; i < newDict.Count; i++)
            {
                string barcode_old = newDict[i]["STR1"].ToString();
                if (barcode_old == tbxBARCODE.Text)
                {
                    Alert.Show("扫描定数条码已存在!");
                    tbxBARCODE.Text = "";
                    tbxBARCODE.Focus();
                    return;
                }
            }
            string code = dtCode.Rows[0]["GDSEQ"].ToString(); //tbxBARCODE.Text.Trim().Substring(13, 12);
            string dept = docDEPTID.SelectedValue;

            if (!string.IsNullOrWhiteSpace(code) && code.Trim().Length >= 2)
            {
                DataTable dt_goods = Doc.GetGoods_His(code, "", dept);

                if (dt_goods != null && dt_goods.Rows.Count > 0)
                {
                    dt_goods.Columns.Add("ONECODE", Type.GetType("System.String"));
                    dt_goods.Columns.Add("BZSL", Type.GetType("System.Int32"));
                    dt_goods.Columns.Add("DHSL", Type.GetType("System.Int32"));
                    dt_goods.Columns.Add("KCSL", Type.GetType("System.Int32"));
                    dt_goods.Columns.Add("HSJE", Type.GetType("System.Double"));
                    dt_goods.Columns["UNITNAME"].ColumnName = "UNITSMALLNAME";
                    DataRow dr_goods = dt_goods.Rows[0];
                    dr_goods["BZSL"]  = barcode.Rows[0]["DHSL"];
                    dr_goods["DHSL"]  = barcode.Rows[0]["DHSL"];
                    dr_goods["KCSL"]  = barcode.Rows[0]["DHSL"];
                    dr_goods["HSJE"]  = Convert.ToDecimal(barcode.Rows[0]["BZSL"]) * Convert.ToDecimal(barcode.Rows[0]["HSJJ"]);
                    dr_goods["PH"]    = barcode.Rows[0]["PH"];
                    dr_goods["PZWH"]  = barcode.Rows[0]["PIZNO"];
                    dr_goods["RQ_SC"] = barcode.Rows[0]["RQ_SC"];
                    dr_goods["YXQZ"]  = barcode.Rows[0]["YXQZ"];
                    //货位使用科室编码
                    dr_goods["HWID"] = dept;
                    dr_goods["STR1"] = tbxBARCODE.Text;
                    LoadGridRow(dr_goods, false);
                    tbxNUM.Text     = (Convert.ToInt16(tbxNUM.Text) + 1).ToString();
                    tbxBARCODE.Text = "";
                    tbxBARCODE.Focus();
                }
                else
                {
                    Alert.Show(string.Format("{0}尚未配置商品【{1}】!!!", docDEPTID.SelectedText, code), MessageBoxIcon.Warning);
                    PubFunc.GridRowAdd(GridGoods, "CLEAR");
                }
            }
        }