Esempio n. 1
0
        private void button_Print_Click(object sender, EventArgs e)
        {
            MyFunc.WriteToDbLog("生成" + mszRptTitle, "", "MSG", MyStart.giUserID);
            string szBgn = string.Format("{0:yyyy-MM-dd HH:mm:ss}", dateTimePicker1.Value);
            string szEnd = string.Format("{0:yyyy-MM-dd  HH:mm:ss}", dateTimePicker2.Value);

            mszRptDate = szBgn + " 至 " + szEnd;
            if (miRows == 0)
            {
                MessageBox.Show("没有数据,不打印", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            string szErr    = "";
            string szRptFle = "";
            bool   bRst     = MyFunc.ExportDataToFile(mszRptTitle, mszRptDate, "", "A,D,E", mszTitle, ref dataGridView1, miRows, "", "E:\\", mszRptTitle + DateTime.Now.ToString("yyyyMMdd"),
                                                      ref szErr);

            if (bRst)
            {
                szRptFle = szErr;
                MessageBox.Show("已生成报表", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("生成报表失败(" + szErr + ")", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (DialogResult.Yes == MessageBox.Show("是否打印报表?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                MyFunc.PrintExcelFile(szRptFle, ref szErr);
            }
        }
Esempio n. 2
0
        private void AddNewFee(string szTitle, string szProdID, string szProdName, string szRateType, string szRate,
                               string szBgn, string szEnd)
        {
            string szSql = "INSERT INTO mng_rate (PROD_ID,RATE_TYPE,BGN_TIME,END_TIME,RATE,RATE_VALID,ADD_DT,ADD_ID,RMRK) VALUES ("
                           + szProdID + "," + szRateType + ",'" + szBgn + " ','" + szEnd + "'," + szRate
                           + ",'Y',curtime()," + MyStart.giUserID.ToString() + ",'" + textBox_Desc.Text + "')";
            string szErr = "";
            int    iRst  = MyStart.oMyDb.WriteData(szSql, ref szErr);

            if (iRst < 1)
            {
                MessageBox.Show("保存出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",Err=" + szErr);
            }
            else
            {
                szSql = szProdName + "-" + textBox_Rate.Text + "% (" + szBgn + "," + szEnd + ")";
                MyFunc.WriteToDbLog(szTitle, szSql, "MSG", MyStart.giUserID);

                //MessageBox.Show("保存成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                GridDataRefresh();
                MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",OK");
            }
            MyStart.oMyDb.Close();
            return;
        }
Esempio n. 3
0
        private void button_Rpt_Click(object sender, EventArgs e)
        {
            MyFunc.WriteToDbLog("生成商场交易汇总报表", "", "MSG", MyStart.giUserID);

            string szErr    = "";
            string szRptFle = "";
            bool   bRst     = MyFunc.ExportDataToFile(mszRptTitle, mszRptDate, "", "A,J,L", mszTitle, ref dataGridViewRst, miRows, "", "E:\\", "市场交易汇总报表" + DateTime.Now.ToString("yyyyMMdd"),
                                                      ref szErr);

            if (bRst)
            {
                szRptFle = szErr;
                MessageBox.Show("已生成报表", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("生成报表失败(" + szErr + ")", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            button_Rpt.Enabled = false;

            if (DialogResult.Yes == MessageBox.Show("是否打印报表?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                MyFunc.PrintExcelFile(szRptFle, ref szErr);
            }

            button_Rpt.Enabled = false;
        }
Esempio n. 4
0
        private void button_Qry_Click(object sender, EventArgs e)
        {
            MyFunc.WriteToDbLog("查询磅房交易汇总", "", "MSG", MyStart.giUserID);
            //MyFunc.WriteToDbLog("查询商品销售汇总", "", "MSG", MyStart.giUserID);
            string szBgn = string.Format("{0:yyyy-MM-dd HH:mm:ss}", dateTimePicker_Bgn.Value);
            string szEnd = string.Format("{0:yyyy-MM-dd  HH:mm:ss}", dateTimePicker_End.Value);

            dataGridViewRst.Rows.Clear();
            if (MyStart.gszMrktName.Length > 0)
            {
                mszRptTitle = MyStart.gszMrktName + "磅房交易表";
            }
            else
            {
                mszRptTitle = "磅房交易表";
            }

            if (radioButton_trade.Checked)
            {
                // mszRptTitle += "(磅房交易)";
                MyFunc.GridInit(ref dataGridViewRst, mszTitle, mszTitleWidth, 15, miDefRows, true);
                string[] szX = mszTitle.Split(',');
                miCols = szX.Length;
                QryTrade(szBgn, szEnd);
            }
            if (radioButton_cash.Checked)
            {
                mszRptTitle += "(财务收银)";
                MyFunc.GridInit(ref dataGridViewRst, mszTitleCash, mszTitleCashWidth, 15, miDefRows, true);
                string[] szX = mszTitleCash.Split(',');
                miCols = szX.Length;
                QryCash(szBgn, szEnd);
            }
        }
Esempio n. 5
0
        private void button_SaveFee_Click(object sender, EventArgs e)
        {
            if (DialogResult.No == MessageBox.Show("确认要保存IC卡工本费吗?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                return;
            }

            string szErr = "";

            try
            {
                int iRst = MyFunc.SetSysParaToDb(MyStart.oMyDb, "FEE_CHG_CARD", miFee.ToString(), ref szErr);
                if (iRst < 0)
                {
                    MessageBox.Show("操作错误:保存IC卡工本费时出错。", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MyFunc.WriteToDbLog("修改运营参数", "IC卡工本费" + textBox_Fee.Text + "元", "MSG", MyStart.giUserID);
                    MessageBox.Show("保存成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("保存IC卡工本费失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            MyStart.oMyDb.Close();
        }
Esempio n. 6
0
        private void button_Qry_Click(object sender, EventArgs e)
        {
            /*
             * select
             * case when Z.USER_NAME is not null then Z.USER_NAME else '合计' end as '收银员',
             * case when Y_TYPE is not null then (if(Y_TYPE='CASH','取款',(if(Y_TYPE='ISSU','开卡',(if(Y_TYPE='ADD','充值','换卡')))))) else '小计' end as '操作类型',
             * case when Y_SubTYPE is not null then Y_SubTYPE else '小计' end as '操作子类型',
             * sum(A) as 卖方卡笔数,format(sum(B)/100,2) as '卖方金额(元)',sum(C) as 买方卡笔数,format(sum(D)/100,2)  as '买方金额(元)',
             * sum(A+C) as 总笔数, format(sum(B+D)/100,2) as '总金额(元)'
             * from
             * ( select Y_ID,Y_TYPE,Y_SubTYPE,
             * case when A is not null then A else 0 end as A,
             * case when B is not null then B else 0 end as B,
             * case when C is not null then C else 0 end as C,
             * case when D is not null then D else 0 end as D
             * from
             * (select Oper_ID as X_ID,Oper_Type as X_TYPE,Oper_SubType as X_SubTYPE,count(Chg_Val) as A,sum(Chg_Val) as B from rec_firm where Oper_Type in('ADD','CASH','ISSU','CHG')  and Oper_Time>'2019-1-19'
             * group by Oper_ID,Oper_Type,Oper_SubType) X
             * right join
             * (select Oper_ID as Y_ID,Oper_Type as Y_TYPE,Oper_SubType as Y_SubTYPE,count(Chg_Val) as C,sum(Chg_Val) as D from rec_user where Oper_Type in('ADD','CASH','ISSU','CHG')  and Oper_Time>'2019-1-19'
             * group by Oper_ID,Oper_Type,Oper_SubType) Y
             * on X_ID=Y_ID and X_TYPE=Y_TYPE and X_SubTYPE=Y_SubTYPE
             * ) XX,sys_users Z
             * where XX.Y_ID=Z.USER_ID
             * group by Z.USER_NAME,XX.Y_TYPE,XX.Y_SubTYPE with rollup
             */
            MyFunc.WriteToDbLog("查询收银汇总", "", "MSG", MyStart.giUserID);
            //MyFunc.WriteToDbLog("查询商品销售汇总", "", "MSG", MyStart.giUserID);
            string szBgn = string.Format("{0:yyyy-MM-dd HH:mm:ss}", dateTimePicker_Bgn.Value);
            string szEnd = string.Format("{0:yyyy-MM-dd  HH:mm:ss}", dateTimePicker_End.Value);

            dataGridViewRst.Rows.Clear();
            if (MyStart.gszMrktName.Length > 0)
            {
                mszRptTitle = MyStart.gszMrktName + "收银汇总表";
            }
            else
            {
                mszRptTitle = "收银汇总表";
            }

            //if (radioButton_trade.Checked)
            //{
            //    mszRptTitle += "(磅房交易)";
            //    MyFunc.GridInit(ref dataGridViewRst, mszTitle, mszTitleWidth, 15, miDefRows, true);
            //    string[] szX = mszTitle.Split(',');
            //    miCols = szX.Length;
            //    QryTrade(szBgn, szEnd);
            //}
            if (radioButton_cash.Checked)
            {
                mszRptTitle += "(财务收银)";
                MyFunc.GridInit(ref dataGridViewRst, mszTitleCash, mszTitleCashWidth, 15, miDefRows, true);
                string[] szX = mszTitleCash.Split(',');
                miCols = szX.Length;
                QryCash(szBgn, szEnd);
            }
        }
Esempio n. 7
0
        private void button_Qry_Click(object sender, EventArgs e)
        {
            MyFunc.WriteToDbLog("查询工作日志", "", "MSG", MyStart.giUserID);
            string szBgn = string.Format("{0:yyyy-MM-dd}", dateTimePicker_Bgn.Value) + " 00:00:00";
            string szEnd = string.Format("{0:yyyy-MM-dd}", dateTimePicker_End.Value) + " 23:59:59";

            dataGridViewRst.Rows.Clear();
            MyFunc.GridInit(ref dataGridViewRst, mszTitle, mszTitleWidth, 15, miDefRows, true);
            try
            {
                DataSet ds    = new DataSet();
                string  szSql = "select user_name,rec_time,log_rmrk,log_info from sys_log a,sys_users b "
                                + "where a.LOG_USER = b.USER_ID and user_type>1 ";
                if (comboBox_User.SelectedIndex > 0)
                {
                    string[] szX = comboBox_User.Text.Split('-');
                    szSql += " and a.LOG_USER = "******" and rec_time>='" + szBgn + "' and rec_time<='" + szEnd + "' order by a.LOG_USER,rec_time desc";
                string szErr = "";
                int    iRst  = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                if (iRst != 0)
                {
                    MessageBox.Show("查询失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog("查询操作日志", "SQL=" + szSql + ",Err=" + szErr);
                    goto Eend;
                }

                DataTable dt = ds.Tables[0];
                mDt = dt;
                int iNum = dt.Rows.Count;
                if (iNum == 0)
                {
                    MessageBox.Show("没有数据", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }
                int iCurNum = (iNum < miDefRows ? miDefRows : iNum);
                MyFunc.GridWriteDt(ref dataGridViewRst, ref dt, 0, miCols, ref iCurNum);
                miRows             = iNum;
                mszRptDate         = string.Format("{0:yyyy-MM-dd}", dateTimePicker_Bgn.Value) + " 至 " + string.Format("{0:yyyy-MM-dd}", dateTimePicker_End.Value);
                button_Rpt.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("查询操作日志失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
Eend:
            MyStart.oMyDb.Close();
        }
Esempio n. 8
0
        private void button_Rpt_Click(object sender, EventArgs e)
        {
            MyFunc.WriteToDbLog("生成销售明细报表", "", "MSG", MyStart.giUserID);
            string szErr    = "";
            string szRptFle = "";
            bool   bRst     = MyFunc.ExportDataToFile(mszRptTitle, mszRptDate, "", "A,Q,S", mszTitle, ref dataGridViewRst, miRows, "", "E:\\", "销售明细报表" + DateTime.Now.ToString("yyyyMMdd"),
                                                      ref szErr);

            if (bRst)
            {
                szRptFle = szErr;
                MessageBox.Show("已生成报表", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("生成报表失败(" + szErr + ")", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            button_Rpt.Enabled = false;

            if (DialogResult.Yes == MessageBox.Show("是否打印报表?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                MyFunc.PrintExcelFile(szRptFle, ref szErr);
            }

            button_Rpt.Enabled = false;
            //        string mszTitle = "交易流水号,交易时间,卖方卡号,买方卡号,商品名称,单价(元),毛重(公斤),皮重(公斤),净重(公斤),总价(元),"
            //            +"市场方服务费率,市场方收费(元),益通宝服务费率,益通宝收费(元),买方支付费率,买方支付(元),卖方支付费率,卖方支付(元)";
            //string szSum="";
            //if (mszSumSql.Length > 0)
            //{
            //    DataSet ds = new DataSet();
            //    int iRst = MyStart.oMyDb.ReadData(mszSumSql, "tableA", ref ds, ref szErr);
            //    if (iRst != 0)
            //    {
            //        MessageBox.Show("查询失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //        MyIniFile.WriteLog("查询交易明细信息", "SQL=" + mszSumSql + ",Err=" + szErr);
            //        return;
            //    }
            //    DataRow dr = ds.Tables[0].Rows[0];
            //    int iNum = mszTitle.Split(',').Length;
            //    for(int i=0;i< iNum; i++)
            //        szSum+=dr[i].ToString()+"|";
            //}
        }
Esempio n. 9
0
        private void button_Rpt_Click(object sender, EventArgs e)
        {
            MyFunc.WriteToDbLog("生成工作日志报表", "", "MSG", MyStart.giUserID);

            string szErr = "";
            bool   bRst  = MyFunc.ExportDataToFile(mszRptTitle, mszRptDate, "", "A,C,D", mszTitle, ref dataGridViewRst, miRows, "", "E:\\", "工作日志报表" + DateTime.Now.ToString("yyyyMMdd"),
                                                   ref szErr);

            if (bRst)
            {
                MessageBox.Show("已生成报表", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("生成报表失败(" + szErr + ")", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            button_Rpt.Enabled = false;
        }
Esempio n. 10
0
        private void EditNewFee(string szTitle, string szProdID, string szProdName, string szRateType, string szRate,
                                string szBgn, string szEnd)
        {
            string szSql = "INSERT INTO mng_rate_his (PROD_ID,RATE_TYPE,BGN_TIME,END_TIME,RATE,RATE_VALID,ADD_DT,ADD_ID,RMRK) VALUES ("
                           + szProdID + "," + szRateType + ",'" + mszBgn + "','"
                           + string.Format("{0:yyyy-MM-dd}", dateTimePicker_Bgn.Value.AddDays(-1))
                           + " 23:59:59'," + szRate + ",'N',curtime()," + MyStart.giUserID.ToString() + ",'" + mszInf + "')";
            string szErr = "";
            int    iRst  = MyStart.oMyDb.WriteData(szSql, ref szErr);

            if (iRst < 1)
            {
                MessageBox.Show("保存修改后的信息出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",Err=" + szErr);
                MyStart.oMyDb.Close();
                return;
            }

            szSql = "UPDATE mng_rate SET BGN_TIME='" + szBgn
                    + "',END_TIME = '" + szEnd
                    + " ',RATE = " + (Convert.ToSingle(textBox_Rate.Text) * 10).ToString()
                    + ",CHG_DT = curtime()"
                    + ",CHG_ID = " + MyStart.giUserID.ToString()
                    + ",RMRK = '" + textBox_Desc.Text
                    + "' where prod_id=" + mszCode + " and rate_type=" + szRateType;
            iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
            if (iRst < 1)
            {
                MessageBox.Show("保存出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",Err=" + szErr);
            }
            else
            {
                szSql = szProdName + "-" + textBox_Rate.Text + "% (" + szBgn + "," + szEnd + ")";
                MyFunc.WriteToDbLog(szTitle, szSql, "MSG", MyStart.giUserID);

                //MessageBox.Show("保存成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                GridDataRefresh();
                MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",OK");
            }
            MyStart.oMyDb.Close();
            return;
        }
Esempio n. 11
0
        private void button_Save_Click(object sender, EventArgs e)
        {
            string szTitle = "人员权限管理";
            string szApp   = GetApp();
            string szSql   = "UPDATE sys_users SET USER_APP = '" + szApp
                             + "',RMRK = '" + textBox_Desc.Text.Trim() + "'";

            if (checkBox_Pos.Checked)//pos
            {
                szSql += ", USER_TYPE=3";
            }
            szSql += " WHERE USER_ID=" + textBox_Code.Text.Trim();
            string szErr = "";

            try
            {
                int iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
                if (iRst < 1)
                {
                    MessageBox.Show("保存出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",Err=" + szErr);
                }
                else
                {
                    szSql = "编号" + mszCode + "-姓名" + mszName + "-权限" + szApp;
                    MyFunc.WriteToDbLog(szTitle, szSql, "MSG", MyStart.giUserID);

                    MessageBox.Show("保存成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    GridDataRefresh();
                    MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",OK");
                }
                groupBoxInf.Enabled  = false;
                groupBoxList.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("保存失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            MyStart.oMyDb.Close();
        }
Esempio n. 12
0
        private void button_Save_Click(object sender, EventArgs e)
        {
            if (textBox_Old_Pwd.Text.Trim().ToUpper().CompareTo(MyStart.gszUserPwd.ToUpper()) != 0)
            {
                MessageBox.Show("旧密码错误!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox_Old_Pwd.Focus();
                return;
            }

            if (textBox_New_Pwd.Text.CompareTo(textBox_2nd_Pwd.Text) != 0)
            {
                MessageBox.Show("两次输入的新密码错误!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox_New_Pwd.Focus();
                return;
            }

            string szNewPwd = MyTools.OpenString_To_HideString((textBox_New_Pwd.Text + "        ").Substring(0, 8),
                                                               MyStart.gszPwdKey);
            string szSql = "UPDATE sys_users SET USER_PWD = '" + szNewPwd
                           + "' WHERE USER_ID=" + MyStart.giUserID;
            string szErr = "";

            try
            {
                int iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
                if (iRst < 1)
                {
                    MessageBox.Show("更改密码失败(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog("当班人员-更改密码", "SQL=" + szSql + ",Err=" + szErr);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("更改密码失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            MyStart.oMyDb.Close();

            MyFunc.WriteToDbLog("当班人员-更改密码", "", "MSG", MyStart.giUserID);
            MessageBox.Show("更改密码成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Esempio n. 13
0
        private void button_Search_Click(object sender, EventArgs e)
        {
            int   iNum   = 0;
            int   iValue = 0;
            int   iRet   = 0;
            float fi     = 0;

            string  sMsg       = "";
            string  sSqlString = "";
            string  sTmp       = "";
            DataSet DS         = null;

            ClearGrid();

            iNum   = 0;
            iValue = 0;

            iUserAddNum   = 0;
            fUserAddValue = 0;
            iFirmAddNum   = 0;
            fFirmAddValue = 0;
            iAddNum       = 0;
            fAddValue     = 0;

            iUserCashNum   = 0;
            fUserCashValue = 0;
            iFirmCashNum   = 0;
            fFirmCashValue = 0;
            iCashNum       = 0;
            fCashValue     = 0;

            if (dateTimePicker1.Value <= dateTimePicker2.Value)
            {
                T1 = DateTime.Parse(dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss"));
                T2 = DateTime.Parse(dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            else
            {
                T1 = DateTime.Parse(dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm:ss"));
                T2 = DateTime.Parse(dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss"));
            }

            try
            {
                int j = 0;
                sSqlString = "SELECT Card_No, Oper_Time, Oper_Type, Chg_Val FROM rec_user WHERE Oper_ID = " + MyStart.giUserID +
                             " AND (Oper_Type = 'ADD' OR Oper_Type = 'CASH') AND Oper_Time Between '" + T1.ToString("yyyy-MM-dd HH:mm:ss") + "' AND '" + T2.ToString("yyyy-MM-dd HH:mm:ss") + "'";
                iRet = MyStart.oMyDb.ReadData(sSqlString, "tableA", ref DS, ref sMsg);
                if (iRet == 0)
                {
                    if (DS.Tables[0].Rows.Count > 0)
                    {
                        iNum = DS.Tables[0].Rows.Count;
                        for (j = 0; j < iNum; j++)
                        {
                            dataGridView1.Rows.Add();

                            dataGridView1.Rows[j].Cells[0].Value = DS.Tables[0].Rows[j]["Card_No"].ToString();
                            dataGridView1.Rows[j].Cells[1].Value = DateTime.Parse(DS.Tables[0].Rows[j]["Oper_Time"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                            dataGridView1.Rows[j].Cells[2].Value = DS.Tables[0].Rows[j]["Oper_Type"].ToString();

                            iValue = int.Parse(DS.Tables[0].Rows[j]["Chg_Val"].ToString());
                            fi     = iValue;
                            fi    /= 100;
                            dataGridView1.Rows[j].Cells[3].Value = fi.ToString("0.00");
                            dataGridView1.Rows[j].Cells[5].Value = "User";
                        }
                    }
                }

                sSqlString = "SELECT Card_No, Oper_Time, Oper_Type, Chg_Val FROM rec_firm WHERE Oper_ID = " + MyStart.giUserID +
                             " AND (Oper_Type = 'ADD' OR Oper_Type = 'CASH') AND Oper_Time Between '" + T1.ToString("yyyy-MM-dd HH:mm:ss") + "' AND '" + T2.ToString("yyyy-MM-dd HH:mm:ss") + "'";
                iRet = MyStart.oMyDb.ReadData(sSqlString, "tableA", ref DS, ref sMsg);
                if (iRet == 0)
                {
                    if (DS.Tables[0].Rows.Count > 0)
                    {
                        for (j = 0; j < DS.Tables[0].Rows.Count; j++)
                        {
                            dataGridView1.Rows.Add();

                            dataGridView1.Rows[j + iNum].Cells[0].Value = DS.Tables[0].Rows[j]["Card_No"].ToString();
                            dataGridView1.Rows[j + iNum].Cells[1].Value = DateTime.Parse(DS.Tables[0].Rows[j]["Oper_Time"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                            dataGridView1.Rows[j + iNum].Cells[2].Value = DS.Tables[0].Rows[j]["Oper_Type"].ToString();

                            iValue = int.Parse(DS.Tables[0].Rows[j]["Chg_Val"].ToString());
                            fi     = iValue;
                            fi    /= 100;
                            dataGridView1.Rows[j + iNum].Cells[3].Value = fi.ToString("0.00");
                            dataGridView1.Rows[j + iNum].Cells[5].Value = "Firm";
                        }
                    }
                    //iNum += DS.Tables[0].Rows.Count;
                }

                if (dataGridView1.Rows.Count > 0)            //已经找到记录了
                {
                    float fii = 0;
                    for (int i = 0; i < dataGridView1.Rows.Count; i++)
                    {
                        sTmp = dataGridView1.Rows[i].Cells[2].Value.ToString();
                        fi   = float.Parse(dataGridView1.Rows[i].Cells[3].Value.ToString());
                        switch (sTmp)
                        {
                        case "ADD":
                            dataGridView1.Rows[i].Cells[2].Value = "充值";
                            fii += fi;
                            iAddNum++;
                            fAddValue += fi;
                            if (dataGridView1.Rows[i].Cells[5].Value.ToString() == "User")
                            {
                                iUserAddNum++;
                                fUserAddValue += fi;
                            }
                            else
                            {
                                iFirmAddNum++;
                                fFirmAddValue += fi;
                            }
                            break;

                        case "CASH":
                            dataGridView1.Rows[i].Cells[2].Value = "取款";
                            fii -= fi;
                            iCashNum++;
                            fCashValue += fi;
                            if (dataGridView1.Rows[i].Cells[5].Value.ToString() == "User")
                            {
                                iUserCashNum++;
                                fUserCashValue += fi;
                            }
                            else
                            {
                                iFirmCashNum++;
                                fFirmCashValue += fi;
                            }
                            break;
                            //case "CHG":
                            //    dataGridView1.Rows[i].Cells[2].Value = "换卡";
                            //    fii += fi;
                            //    iChangeNum++;
                            //    fChangeValue += fi;
                            //    break;
                            //case "SETT":
                            //    dataGridView1.Rows[i].Cells[2].Value = "结算";
                            //    fii += fi;
                            //    iSettNum++;
                            //    fSettValue += fi;
                            //    break;
                            //    //case "TRADE":
                            //    //    dataGridView1.Rows[i].Cells[2].Value = "消费";
                            //    //    break;
                            //    //case "CANC":
                            //    //    dataGridView1.Rows[i].Cells[2].Value = "取消";
                            //    //    break;
                        }
                        dataGridView1.Rows[i].Cells[4].Value = fii.ToString("0.00");
                    }

                    dataGridView2.Rows[0].Cells[1].Value = iUserAddNum.ToString();
                    dataGridView2.Rows[1].Cells[1].Value = fUserAddValue.ToString("0.00");

                    dataGridView2.Rows[0].Cells[2].Value = iFirmAddNum.ToString();
                    dataGridView2.Rows[1].Cells[2].Value = fFirmAddValue.ToString("0.00");

                    dataGridView2.Rows[0].Cells[3].Value = iAddNum.ToString();
                    dataGridView2.Rows[1].Cells[3].Value = fAddValue.ToString("0.00");

                    dataGridView2.Rows[0].Cells[4].Value = iUserCashNum.ToString();
                    dataGridView2.Rows[1].Cells[4].Value = fUserCashValue.ToString("0.00");

                    dataGridView2.Rows[0].Cells[5].Value = iFirmCashNum.ToString();
                    dataGridView2.Rows[1].Cells[5].Value = fFirmCashValue.ToString("0.00");

                    dataGridView2.Rows[0].Cells[6].Value = iCashNum.ToString();
                    dataGridView2.Rows[1].Cells[6].Value = fCashValue.ToString("0.00");

                    dataGridView2.Rows[0].Cells[7].Value = dataGridView1.Rows.Count.ToString();
                    dataGridView2.Rows[1].Cells[7].Value = fii.ToString("0.00");

                    dataGridView1.Focus();
                    dataGridView1.Rows[0].Selected = true;
                }
                else
                {
                    MessageBox.Show("没有找到符合条件的记录。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                // log
                MyFunc.WriteToDbLog("当班人员-收银结算", "", "MSG", MyStart.giUserID);

                groupBox1.Enabled = false;
                groupBox2.Visible = true;
                button_New.Focus();
                //return;
            }
            catch (Exception ex)
            {
                MessageBox.Show("检索失败:" + ex, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            MyStart.oMyDb.Close();
        }
Esempio n. 14
0
        private void button_MinusValue_Click(object sender, EventArgs e)
        {
            float fValue   = 0.00f;
            float fBalance = 0;

            textBox_Value.Text  = textBox_Value.Text.Trim();
            textBox_Value2.Text = textBox_Value2.Text.Trim();
            try
            {
                fValue = float.Parse(textBox_Value.Text.Trim());
            }
            catch
            {
                MessageBox.Show("取款金额错误!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                textBox_Value.Focus();
                return;
            }

            if (textBox_Value.Text != textBox_Value2.Text)
            {
                MessageBox.Show("两次输入的取款金额不相等!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                textBox_Value.Focus();
                return;
            }

            if (fValue == 0)
            {
                MessageBox.Show("取款金额不能为0!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                textBox_Value.Focus();
                return;
            }

            //// 检查密码
            //if ( CardPwd != textBox_Pwd.Text.Trim())
            //{
            //    MessageBox.Show("取款密码错误!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    textBox_Pwd.Focus();
            //    return;
            //}

            // 检查余额是否足够
            if (mszFlag.ToUpper() == "FIRM_CARD")
            {
                fBalance = float.Parse(textBox_FinishBalance.Text.Trim());
            }
            else
            {
                fBalance = float.Parse(textBox_OldBalance.Text.Trim());
            }

            if (fValue > fBalance)
            {
                MessageBox.Show("取款金额不足够!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                textBox_Value.Focus();
                return;
            }

            // 取得TradeID
            if (!myRdr.ComOpen(frm_Main.sRdPort))
            {
                MessageBox.Show("打开串口失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                myRdr.ComClose();
                return;
            }

            int iReaderTradeID = 0;

            if (!myRdr.GetTradeID(ref iReaderTradeID))
            {
                MessageBox.Show("交易失败:不能从读写器获取交易流水。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                myRdr.ComClose();
                return;
            }
            myRdr.ComClose();

            //银石后台
            objHttp = new EbHttpClass();

            fValue *= -1;
            string szSysID = iReaderTradeID.ToString();
            string szErr   = "";
            bool   bRst    = false;

            if (mszFlag.ToUpper() == "USER_CARD")
            {
                bRst = objHttp.OperUserMoney("MinusVal", textBox_UserCardID.Text, fValue, szSysID, textBox_Pwd.Text.Trim(), ref szErr);
            }
            else
            {
                bRst = objHttp.OperFirmMoney(sStoreCard.Substring(1), textBox_UserCardID.Text, fValue, szSysID, textBox_Pwd.Text.Trim(), ref szErr);
            }

            if (bRst)
            {
                string sSql  = "";
                string szInf = "";
                float  f     = 0;
                int    i;

                // 余额显示
                fValue *= -1;
                f       = fBalance - fValue;
                textBox_NewBalance.Text = f.ToString("0.00");

                // 写入数据库
                if (mszFlag.ToUpper() == "USER_CARD")
                {
                    // 写入数据库
                    sSql = "INSERT INTO rec_user (Card_No, Oper_Time, Oper_Type,Oper_SubType, Before_Val, Chg_Val, After_Val, Oper_ID, Tmn_ID, Sys_ID) VALUE(" +
                           "'" + textBox_UserCardID.Text + "'," +
                           "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," +
                           "'CASH','" + comboBox_Type.Text.Trim() + "',";
                    f     = float.Parse(textBox_OldBalance.Text);
                    f    *= 100;
                    i     = (int)(f + 0.5);
                    sSql += i.ToString() + ",";

                    f     = float.Parse(textBox_Value.Text);
                    f    *= 100;
                    i     = (int)(f + 0.5);
                    sSql += i.ToString() + ",";

                    f     = float.Parse(textBox_NewBalance.Text);
                    f    *= 100;
                    i     = (int)(f + 0.5);
                    sSql += i.ToString() + "," +
                            MyStart.giUserID + "," +
                            "'" + frm_Main.POS_ID + "'," +
                            iReaderTradeID.ToString() + ")";
                }
                else
                {
                    sSql = "INSERT INTO rec_firm (Card_No, Rmrk, STORE_ID, Oper_Time, Oper_Type,Oper_SubType, Before_Val, Chg_Val, After_Val, Oper_ID, Tmn_ID, Sys_ID) VALUE(" +
                           "'" + textBox_UserCardID.Text + "'," +
                           "'" + sStoreCard + "'," +
                           sStoreID + "," +
                           "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," +
                           "'CASH','" + comboBox_Type.Text.Trim() + "',";

                    f     = float.Parse(textBox_OldBalance.Text);
                    f    *= 100;
                    i     = (int)(f + 0.5);
                    sSql += i.ToString() + ",";

                    f     = float.Parse(textBox_Value.Text);
                    f    *= 100;
                    i     = (int)(f + 0.5);
                    sSql += i.ToString() + ",";

                    f     = float.Parse(textBox_NewBalance.Text);
                    f    *= 100;
                    i     = (int)(f + 0.5);
                    sSql += i.ToString() + "," +
                            MyStart.giUserID + "," +
                            "'" + frm_Main.POS_ID + "'," + szSysID.ToString() + ")";
                }

                int iRst = MyStart.oMyDb.WriteData(sSql, ref szInf);
                if (iRst <= 0)
                {
                    textBox_Result.Text = "取款成功! 但写数据库失败(" + szInf + ")";
                }
                else
                {
                    textBox_Result.Text = "取款成功!";
                }
                // log
                if (mszFlag.ToUpper() == "USER_CARD")
                {
                    MyFunc.WriteToDbLog("买方资金-退款", "买方卡号=" + textBox_UserCardID.Text + ",取款=" + textBox_Value.Text + "元,时间=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "MSG", MyStart.giUserID);
                }
                else
                {
                    MyFunc.WriteToDbLog("卖方资金-提款", "卖方卡号=" + textBox_UserCardID.Text + ",取款=" + textBox_Value.Text + "元,时间=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "MSG", MyStart.giUserID);
                }

                MyStart.oMyDb.Close();

                //打印票据
                button_Print_Click(sender, e);
                button_Print_Click(sender, e);
            }
            else
            {
                textBox_Result.Text     = "取款失败 = " + szErr;
                textBox_NewBalance.Text = textBox_FinishBalance.Text;
            }

            groupBox_ThirdStep.Enabled  = false;
            groupBox_FourthStep.Visible = true;
            groupBox_FourthStep.Enabled = true;
            button_Retry.Focus();
        }
Esempio n. 15
0
        private void button_Save_Click(object sender, EventArgs e)
        {
            string sIniFileName  = Application.StartupPath + "\\YTB.ini";
            int    sI            = 0;
            string sErrorMessage = "";
            string sTmp;

            /*
             * if (textBox_Pwd1.Text.Trim() != textBox_Pwd2.Text.Trim())
             * {
             *  sI = -1;
             *  sErrorMessage = "两次输入的系统登录密码不相等,请更正";
             *  goto Eend;
             * }
             * if (textBox_Pwd1.Text.Length > 8)
             * {
             *  sI = -1;
             *  sErrorMessage = "系统登录密码长度不能超过8个字节,请更正";
             *  goto Eend;
             * }
             * //if (textBox_SrvUserPass.Text.Length > 8)
             * //{
             * //    sI = -1;
             * //    sErrorMessage = "数据库密码长度不能超过8个字节,请更正";
             * //    goto Eend;
             * //}
             */
            sI = -1;
            MyStart.gszDbIp    = textBox_SrvIP.Text.Trim();
            MyStart.gszDbPort  = textBox_SrvPort.Text.Trim();
            MyStart.gszDbLogin = textBox_SrvUserName.Text.Trim();
            MyStart.gszDbPwd   = textBox_SrvUserPass.Text;
            MyStart.gszDbSrv   = textBox_SrvDataBase.Text.Trim();

            MyStart.gszYTBIp   = textBox_YTB_IP.Text;
            MyStart.gszYTBPort = textBox_YTB_PORT.Text;

            MyStart.gszRdrPort  = comboBox_Rdr_Comm.Text.Substring(4);
            MyStart.gszRdr2Port = comboBox_Rdr2_Comm.Text.Substring(4);
            MyStart.gszRdrBaud  = comboBox_Rdr_Baud.Text;

            MyStart.gszPsPort = comboBox_PS_Comm.Text.Substring(4);
            MyStart.gszPsBaud = comboBox_PS_Baud.Text;

            /*sI = MyIniFile.SetIniKeyValue(sIniFileName, "Sys", "Login", MyStart.szSysLogin);
             * if (sI < 0)
             * {
             *  sErrorMessage = "保存 " + sIniFileName + "文件的 Sys.Login" + " 项时出错";
             *  goto Eend;
             * }
             *
             * sTmp = MyTools.OpenString_To_HideString((textBox_Pwd1.Text + "        ").Substring(0, 8));
             * sI = MyIniFile.SetIniKeyValue(sIniFileName, "Sys", "Pwd", sTmp);
             * if (sI < 0)
             * {
             *  sErrorMessage = "保存 " + sIniFileName + "文件的 Sys.Pwd" + " 项时出错";
             *  goto Eend;
             * }*/

            sI = MyIniFile.SetIniKeyValue(sIniFileName, "Db", "IP", MyStart.gszDbIp);
            if (sI < 0)
            {
                sErrorMessage = "保存 " + sIniFileName + "文件的 Db.IP" + " 项时出错";
                goto Eend;
            }
            sI = MyIniFile.SetIniKeyValue(sIniFileName, "Db", "Port", MyStart.gszDbPort);
            if (sI < 0)
            {
                sErrorMessage = "保存 " + sIniFileName + "文件的 Db.Port" + " 项时出错";
                goto Eend;
            }
            sI = MyIniFile.SetIniKeyValue(sIniFileName, "Db", "Srv", MyStart.gszDbSrv);
            if (sI < 0)
            {
                sErrorMessage = "保存 " + sIniFileName + "文件的 Db.Srv" + " 项时出错";
                goto Eend;
            }
            sI = MyIniFile.SetIniKeyValue(sIniFileName, "Db", "Login", MyStart.gszDbLogin);
            if (sI < 0)
            {
                sErrorMessage = "保存 " + sIniFileName + "文件的 Db.Login" + " 项时出错";
                goto Eend;
            }
            if (textBox_SrvUserPass.Text.Length <= 8)
            {
                sTmp = MyTools.OpenString_To_HideString((textBox_SrvUserPass.Text + "        ").Substring(0, 8), MyIniFile.mszIniKey);
            }
            else
            {
                sTmp  = MyTools.OpenString_To_HideString((textBox_SrvUserPass.Text.Substring(0, 8)), MyIniFile.mszIniKey);
                sTmp += MyTools.OpenString_To_HideString((textBox_SrvUserPass.Text.Substring(8) + "        ").Substring(0, 8), MyIniFile.mszIniKey);
            }
            sI = MyIniFile.SetIniKeyValue(sIniFileName, "Db", "Pwd", sTmp);
            if (sI < 0)
            {
                sErrorMessage = "保存 " + sIniFileName + "文件的 Db.Pwd" + " 项时出错";
                goto Eend;
            }

            string szErr = "";

            sI = MyFunc.SetSysParaToDb(MyStart.oMyDb, "YTB_SRV", MyStart.gszYTBIp, ref szErr);
            if (sI < 0)
            {
                sErrorMessage = "保存益通宝平台.IP" + " 项时出错";
                goto Eend;
            }
            sI = MyFunc.SetSysParaToDb(MyStart.oMyDb, "YTB_PORT", MyStart.gszYTBPort, ref szErr);
            if (sI < 0)
            {
                sErrorMessage = "保存益通宝平台.端口" + " 项时出错";
                goto Eend;
            }
            sI = MyFunc.SetSysParaToDb(MyStart.oMyDb, "RDR_PORT", MyStart.gszRdrPort, ref szErr);
            if (sI < 0)
            {
                sErrorMessage = "保存读卡器.连接端口" + " 项时出错";
                goto Eend;
            }
            sI = MyFunc.SetSysParaToDb(MyStart.oMyDb, "RDR2_PORT", MyStart.gszRdr2Port, ref szErr);
            if (sI < 0)
            {
                sErrorMessage = "保存后台用读卡器.连接端口" + " 项时出错";
                goto Eend;
            }
            sI = MyFunc.SetSysParaToDb(MyStart.oMyDb, "RDR_BAUD", MyStart.gszRdrBaud, ref szErr);
            if (sI < 0)
            {
                sErrorMessage = "保存读卡器.连接波特率" + " 项时出错";
                goto Eend;
            }
            sI = MyFunc.SetSysParaToDb(MyStart.oMyDb, "PS_PORT", MyStart.gszPsPort, ref szErr);
            if (sI < 0)
            {
                sErrorMessage = "保存磅秤.连接端口" + " 项时出错";
                goto Eend;
            }
            sI = MyFunc.SetSysParaToDb(MyStart.oMyDb, "PS_BAUD", MyStart.gszPsBaud, ref szErr);
            if (sI < 0)
            {
                sErrorMessage = "保存磅秤.连接波特率" + " 项时出错";
                goto Eend;
            }

Eend:
            //string sUserTZM = MyTools.sGetMachineTZM();
            //if (MyStart.sUserAuthCode == MyTools.sGetAuthCode(sUserTZM))
            //    MyStart.bAuthCodeIsOK = true;
            //else
            //    MyStart.bAuthCodeIsOK = false;
            button_Edit.Enabled = true;
            button_Save.Enabled = false;
            button_Quit.Enabled = false;
            button_Exit.Enabled = true;

            groupBox_YTB.Enabled = false;
            groupBox_RDR.Enabled = false;
            groupBox_PS.Enabled  = false;
            groupBox_Db.Enabled  = false;
            if (sI < 0)
            {
                MessageBox.Show("操作错误:" + sErrorMessage + "。", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MyFunc.WriteToDbLog("修改系统参数", "", "MSG", MyStart.giUserID);
                //MessageBox.Show("Ini文件保存成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MessageBox.Show("保存成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            button_Exit.Select();
            MyStart.oMyDb.Close();
        }
Esempio n. 16
0
        private void button_Save_Click(object sender, EventArgs e)
        {
            string sIniFileName  = Application.StartupPath + "\\SYS.ini";
            int    sI            = -1;
            string sErrorMessage = "";

            //string sTmp;

            MyStart.gszMrktMnger = textBox_mrkt_mnger.Text.Trim();
            MyStart.gszMrktName  = textBox_mrkt_name.Text.Trim();
            MyStart.gszMrktAddr  = textBox_mrkt_addr.Text.Trim();
            MyStart.gszMrktTel   = textBox_mrkt_tel.Text.Trim();
            MyStart.gszFirmID    = textBox_Firm_ID.Text.Trim();
            //MyStart.gszPosID = textBox_Pos_ID.Text.Trim();
            MyStart.gszCardFirmFirst = textBox_Card_Firm.Text.Trim();
            MyStart.gszCardYtbFirst  = textBox_Card_YTB.Text.Trim();
            //MyStart.giFeeChgCard = Convert.ToInt16(Convert.ToDecimal(textBox_FeeChgCard.Text.Trim())*100)/100;
            if (textBox_FeeChgCard.Text.Trim().Length == 0)
            {
                MyStart.giFeeChgCard = 0;
            }
            else
            {
                MyStart.giFeeChgCard = (int)(Convert.ToDecimal(textBox_FeeChgCard.Text.Trim()));
            }
            string szWeight = "";

            if (radioButton_kg.Checked)
            {
                MyStart.gszWeight = "公斤";
                szWeight          = "2";
            }
            if (radioButton_jin.Checked)
            {
                MyStart.gszWeight = "斤";
                szWeight          = "1";
            }
            dataGridViewTmn.ReadOnly = true;

            string szErr = "";

            sI = MyFunc.SetSysParaToDb(MyStart.oMyDb, "MKT_GROUP", MyStart.gszMrktName, ref szErr);
            if (sI < 0)
            {
                sErrorMessage = "保存市场管理方" + " 项时出错";
                goto Eend;
            }
            sI = MyFunc.SetSysParaToDb(MyStart.oMyDb, "MKT_NAME", MyStart.gszMrktName, ref szErr);
            if (sI < 0)
            {
                sErrorMessage = "保存市场名称" + " 项时出错";
                goto Eend;
            }
            sI = MyFunc.SetSysParaToDb(MyStart.oMyDb, "MKT_ADDR", MyStart.gszMrktAddr, ref szErr);
            if (sI < 0)
            {
                sErrorMessage = "保存市场地址" + " 项时出错";
                goto Eend;
            }
            sI = MyFunc.SetSysParaToDb(MyStart.oMyDb, "MKT_TELE", MyStart.gszMrktTel, ref szErr);
            if (sI < 0)
            {
                sErrorMessage = "保存市场电话" + " 项时出错";
                goto Eend;
            }
            sI = MyFunc.SetSysParaToDb(MyStart.oMyDb, "FIRM_ID", MyStart.gszFirmID, ref szErr);
            if (sI < 0)
            {
                sErrorMessage = "保存供应商编码" + " 项时出错";
                goto Eend;
            }
            //sI = MyFunc.SetSysParaToDb(MyStart.oMyDb, "POS_ID", MyStart.gszPosID, ref szErr);
            //if (sI < 0)
            //{
            //    sErrorMessage = "保存终端代码" + " 项时出错";
            //    goto Eend;
            //}
            sI = MyFunc.SetSysParaToDb(MyStart.oMyDb, "CARD_FIRM", MyStart.gszCardFirmFirst, ref szErr);
            if (sI < 0)
            {
                sErrorMessage = "保存卖方卡第一位编码" + " 项时出错";
                goto Eend;
            }
            sI = MyFunc.SetSysParaToDb(MyStart.oMyDb, "CARD_YTB", MyStart.gszCardYtbFirst, ref szErr);
            if (sI < 0)
            {
                sErrorMessage = "保存买方卡第一位编码" + " 项时出错";
                goto Eend;
            }
            sI = MyFunc.SetSysParaToDb(MyStart.oMyDb, "WEIGHT_UNIT", szWeight, ref szErr);
            if (sI < 0)
            {
                sErrorMessage = "保存计重单位" + " 项时出错";
                goto Eend;
            }
            sI = MyFunc.SetSysParaToDb(MyStart.oMyDb, "FEE_CHG_CARD", MyStart.giFeeChgCard.ToString(), ref szErr);
            if (sI < 0)
            {
                sErrorMessage = "保存换卡手续费" + " 项时出错";
                goto Eend;
            }

            int     iRows = dataGridViewTmn.Rows.Count;
            int     iNum  = 0;
            string  szSql = "";
            DataSet ds    = new DataSet();
            int     iRst  = 0;

            try
            {
                szSql = "delete from base_value";
                szErr = "";
                iRst  = MyStart.oMyDb.WriteData(szSql, ref szErr);

                string   szX    = textBox_MinusType.Text.Replace("\r\n", ",");
                string[] szItem = szX.Split(',');
                iNum  = szItem.Length;
                szSql = "insert into base_value (type,sub_type) values ";
                for (int i = 0; i < iNum; i++)
                {
                    if (szItem[i].Trim().Length == 0)
                    {
                        continue;
                    }
                    szSql += "(2,'" + szItem[i] + "'),";
                }
                szX    = textBox_AddType.Text.Replace("\r\n", ",");
                szItem = szX.Split(',');
                iNum   = szItem.Length;
                for (int i = 0; i < iNum; i++)
                {
                    if (szItem[i].Trim().Length == 0)
                    {
                        continue;
                    }
                    szSql += "(1,'" + szItem[i] + "'),";
                }
                szSql = szSql.Substring(0, szSql.Length - 1);
                szErr = "";
                iRst  = MyStart.oMyDb.WriteData(szSql, ref szErr);

                for (int i = 0; i < iRows; i++)
                {
                    string szPsamID   = dataGridViewTmn.Rows[i].Cells[0].Value.ToString().Trim();
                    string szPosID    = dataGridViewTmn.Rows[i].Cells[1].Value.ToString().Trim();
                    string szPosName  = dataGridViewTmn.Rows[i].Cells[2].Value.ToString().Trim();
                    string szPsamStat = "N";
                    if (dataGridViewTmn.Rows[i].Cells[3].Value.ToString().Trim().CompareTo("有效") == 0)
                    {
                        szPsamStat = "Y";
                    }

                    szSql = "select * from base_psam where psam_no='" + szPsamID + "'";
                    //string szErr="";
                    iRst = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                    if (iRst != 0)
                    {
                        sErrorMessage = "保存终端编码(查询失败)" + " 项时出错";
                        goto Eend;
                    }
                    iNum = ds.Tables[0].Rows.Count;
                    if (iNum == 0)//add
                    {
                        szSql = "INSERT INTO base_psam (TMN_CODE,TMN_NAME,PSAM_NO,PSAM_STAT) VALUES ('"
                                + szPosID + "','" + szPosName + "','" + szPsamID + "','" + szPsamStat + "')";
                    }
                    else//edit
                    {
                        szSql = "UPDATE base_psam SET TMN_CODE = '" + szPosID + "',TMN_NAME='" + szPosName + "',"
                                + "PSAM_STAT = '" + szPsamStat + "' WHERE PSAM_NO='" + szPsamID + "'";
                    }

                    iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
Eend:
            button_Edit.Enabled = true;
            button_Save.Enabled = false;
            button_Quit.Enabled = false;
            button_Exit.Enabled = true;

            groupBox_para.Enabled = false;
            if (sI < 0)
            {
                MessageBox.Show("操作错误:" + sErrorMessage + "。", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MyFunc.WriteToDbLog("修改运营参数", "", "MSG", MyStart.giUserID);
                //MessageBox.Show("Ini文件保存成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MessageBox.Show("保存成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            button_Exit.Select();
            MyStart.oMyDb.Close();
        }
Esempio n. 17
0
        private void button_Save_Click(object sender, EventArgs e)
        {
            if (DialogResult.No == MessageBox.Show("请确认要保存该档口信息", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information))
            {
                MessageBox.Show("取消当前保存操作", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            string szSql;
            string szTitle;
            string szErr = "";
            int    iRst;

            string[] szItem = comboBox_Name.Text.Split('-');
            if (comboBox_Name.Enabled)//add
            {
                /*if (textBox_Cert.TextLength == 0)
                 * {
                 *  MessageBox.Show("请输入卖方联系人身份证号", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 *  textBox_Cert.SelectAll();
                 *  textBox_Cert.Focus();
                 *  return;
                 * }
                 * if (textBox_Cell.TextLength == 0)
                 * {
                 *  MessageBox.Show("请输入卖方联系电话", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 *  textBox_Cell.SelectAll();
                 *  textBox_Cell.Focus();
                 *  return;
                 * }*/
                szTitle = "卖方档口信息-新增";
                szSql   = "INSERT INTO base_stall(STORE_ID,STALL_INF,STALL_PERSON,STALL_TEL,RENT_BGN,STALL_STAT) VALUES "
                          + "(" + szItem[0].Trim() + ",'" + textBox_Desc.Text.Trim() + "','"
                          + textBox_Person.Text.Trim() + "','" + textBox_Cell.Text.Trim() + "','"
                          + dateTimePicker_valid.Value + "','USED')";
            }
            else//edit
            {
                szTitle = "卖方档口信息-修改";
                if (radioButton_Bgn.Checked)
                {
                    mszBgn = dateTimePicker_valid.Value.ToString();
                }
                szSql = "UPDATE base_stall SET STORE_ID = " + szItem[0].Trim()
                        + ",STALL_PERSON = '" + textBox_Person.Text.Trim()
                        + "',STALL_TEL = '" + textBox_Cell.Text.Trim()
                        + "',STALL_INF = '" + textBox_Desc.Text.Trim() + "',";
                if (radioButton_Bgn.Checked)
                {
                    szSql += "RENT_BGN='" + dateTimePicker_valid.Value + "' ";
                }
                if (radioButton_End.Checked)
                {
                    if (dateTimePicker_valid.Value <= Convert.ToDateTime(mszBgn))
                    {
                        MessageBox.Show("退租日期应该晚于租用日期,请重新设置", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        dateTimePicker_valid.Focus();
                        return;
                    }
                    szSql += "RENT_END='" + dateTimePicker_valid.Value + "' ";

                    if (dateTimePicker_valid.Value <= DateTime.Now)
                    {
                        szSql += ",STALL_STAT='STOP' ";
                    }
                }
                szSql += " WHERE STALL_ID=" + textBox_Code.Text.Trim();
            }
            try
            {
                iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
                if (iRst < 1)
                {
                    MessageBox.Show("保存出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",Err=" + szErr);
                }
                else
                {
                    szSql = "卖方名:" + comboBox_Name.Text + "-档口信息:" + textBox_Code.Text + textBox_Desc.Text;
                    MyFunc.WriteToDbLog(szTitle, szSql, "MSG", MyStart.giUserID);

                    MessageBox.Show("保存成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    GridDataRefresh(Convert.ToInt16(mszSotreID));
                    //dataGridView1.Refresh();
                    MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",OK");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("保存档口信息失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            MyStart.oMyDb.Close();

            groupBoxInf.Enabled  = false;
            groupBoxList.Enabled = true;

            textBox_Code.Text   = mszCode;
            comboBox_Name.Text  = mszName;
            textBox_Person.Text = mszPerson;
            textBox_Cell.Text   = mszCell;
            //if(radioButton_Bgn.Checked)
            //dateTimePicker_valid.Text = mszBgn;
            textBox_Desc.Text = mszInf;
        }
Esempio n. 18
0
        private void button_Save_Click(object sender, EventArgs e)
        {
            string szSql;
            string szTitle;
            string szErr = "";
            int    iRst;

            if (DialogResult.No == MessageBox.Show("请确认要保存该工作网点信息", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information))
            {
                MessageBox.Show("取消当前保存操作", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (miType == 1)//add
            {
                szTitle = "工作网点基本信息-新增";
            }
            else//edit
            {
                szTitle = "工作网点基本信息-修改";
            }

            if (textBox_Name.Text.Length == 0)
            {
                MessageBox.Show("网点名称不能为空,请重新输入", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox_Name.SelectAll();
                textBox_Name.Focus();
                return;
            }

            if (textBox_Key.Text.Length == 0)
            {
                MessageBox.Show("KEY值不能为空,请重新输入", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox_Key.SelectAll();
                textBox_Key.Focus();
                return;
            }

            if (textBox_tellerNo.Text.Length == 0)
            {
                MessageBox.Show("发起方操作员不能为空,请重新输入", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox_tellerNo.SelectAll();
                textBox_tellerNo.Focus();
                return;
            }

            if (textBox_Psam.Text.Length == 0)
            {
                MessageBox.Show("PSAM卡不能为空,请重新输入", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox_Psam.SelectAll();
                textBox_Psam.Focus();
                return;
            }
            try
            {
                if (miType == 1)//add
                {
                    szSql = "select * from base_net where psam_no='" + textBox_Psam.Text.Trim() + "'";
                    DataSet ds = new DataSet();
                    iRst = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                    if (iRst < 0)
                    {
                        MessageBox.Show("查询信息出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",Err=" + szErr);
                        goto Eend;
                    }
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        MessageBox.Show("PSAM卡号不能重复,请重新输入", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",Err=PSAM卡号不能重复,请重新输入");
                        textBox_Psam.SelectAll();
                        textBox_Psam.Focus();
                        goto Eend;
                    }

                    szSql = "INSERT INTO base_net(net_name,net_key,teller_no,psam_no,tel) VALUES ('"
                            + textBox_Name.Text.Trim() + "','" + textBox_Key.Text.Trim() + "','" + textBox_tellerNo.Text.Trim() + "','"
                            + textBox_Psam.Text.Trim() + "','" + textBox_tel.Text.Trim() + "')";
                }
                else//edit
                {
                    szSql = "UPDATE base_net SET net_name = '" + textBox_Name.Text.Trim()
                            + "',net_key = '" + textBox_Key.Text.Trim()
                            + "',tel = '" + textBox_tel.Text.Trim()
                            + "',teller_no = '" + textBox_tellerNo.Text.Trim()
                            + "' WHERE psam_no=" + textBox_Psam.Text.Trim();
                }
                iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
                if (iRst < 1)
                {
                    MessageBox.Show("保存出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",Err=" + szErr);
                }
                else
                {
                    szSql = "PSAM号" + mszPsam + "-网点名称" + mszName;
                    MyFunc.WriteToDbLog(szTitle, szSql, "MSG", MyStart.giUserID);

                    MessageBox.Show("保存成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    GridDataRefresh();
                    //dataGridView1.Refresh();
                    MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",OK");
                }
                groupBoxInf.Enabled  = false;
                groupBoxList.Enabled = true;

                mszName   = textBox_Name.Text;
                mszKey    = textBox_Key.Text;
                mszPsam   = textBox_Psam.Text;
                mszTeller = textBox_tellerNo.Text;
                mszTel    = textBox_tel.Text;
            }
            catch (Exception ex)
            {
                MessageBox.Show("保存失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
Eend:
            MyStart.oMyDb.Close();
            //textBox_Name.Text = mszName;
            //textBox_Psam.Text = mszPsam;
            //textBox_Key.Text = mszKey;
            //textBox_tellerNo.Text = mszTeller;
            //textBox_tel.Text = mszTel;
        }
Esempio n. 19
0
        private void button_Save_Click(object sender, EventArgs e)
        {
            if (DialogResult.No == MessageBox.Show("请确认要保存该分类信息", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information))
            {
                MessageBox.Show("取消当前保存操作", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            string szSql;
            string szTitle;

            if (textBox_Code.Enabled)//add
            {
                bool bSameID = false;
                int  iNum    = dataGridView1.Rows.Count;
                for (int i = 0; i < iNum; i++)
                {
                    if (dataGridView1.Rows[i].Cells[0].Value != null)
                    {
                        if (dataGridView1.Rows[i].Cells[0].Value.ToString() == textBox_Code.Text.Trim())
                        {
                            bSameID = true;
                            break;
                        }
                    }
                }
                if (bSameID)
                {
                    MessageBox.Show("商品的分类编号不能重复,请重新设置", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    textBox_Code.SelectAll();
                    textBox_Code.Focus();
                    return;
                }
                szTitle = "商品分类信息-新增";
                szSql   = "INSERT INTO base_prod(PROD_ID,PROD_NAME,PROD_LEVEL) VALUES("
                          + textBox_Code.Text.Trim() + ",'" + textBox_Name.Text.Trim() + "',0)";
            }
            else//edit
            {
                szTitle = "商品分类信息-修改";
                szSql   = "UPDATE base_prod SET PROD_NAME='" + textBox_Name.Text.Trim()
                          + "',PROD_RMRK = '" + textBox_Desc.Text.Trim()
                          + "' WHERE PROD_ID=" + textBox_Code.Text.Trim();
            }
            string szErr = "";

            try
            {
                int iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
                if (iRst < 1)
                {
                    MessageBox.Show("保存出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",Err=" + szErr);
                }
                else
                {
                    szSql = "编号" + mszCode + "-分类名称" + mszName;
                    MyFunc.WriteToDbLog(szTitle, szSql, "MSG", MyStart.giUserID);

                    MessageBox.Show("保存成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    GridDataRefresh();
                    //dataGridView1.Refresh();
                    MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",OK");
                }
                groupBoxInf.Enabled  = false;
                groupBoxList.Enabled = true;

                textBox_Code.Text = mszCode;
                textBox_Name.Text = mszName;
                textBox_Desc.Text = mszInf;
            }
            catch (Exception ex)
            {
                MessageBox.Show("保存失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            MyStart.oMyDb.Close();
        }
Esempio n. 20
0
        private void button_AddValue_Click(object sender, EventArgs e)
        {
            float fi = 0;

            textBox_Value.Text  = textBox_Value.Text.Trim();
            textBox_Value2.Text = textBox_Value2.Text.Trim();
            if (textBox_Value.Text == "")
            {
                MessageBox.Show("请输入充值金额。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (textBox_Value.Text != textBox_Value2.Text)
            {
                MessageBox.Show("两次输入的充值金额不相等。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            try
            {
                fi = float.Parse(textBox_Value.Text);
            }
            catch
            {
                MessageBox.Show("请输入正确的充值金额。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            // 取得TradeID
            if (!myRdr.ComOpen(frm_Main.sRdPort))
            {
                MessageBox.Show("打开串口失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                myRdr.ComClose();
                return;
            }

            int iReaderTradeID = 0;

            if (!myRdr.GetTradeID(ref iReaderTradeID))
            {
                MessageBox.Show("交易失败:不能从读写器获取交易流水。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                myRdr.ComClose();
                return;
            }
            myRdr.ComClose();

            string   szSysID    = iReaderTradeID.ToString();
            string   sErrMsg    = "";
            string   sSql       = "";
            DateTime dTradeTime = DateTime.Now;

            bool bRst = objHttp.OperUserMoney("AddVal", textBox_CardID.Text, fi, szSysID, "", ref sErrMsg);

            if (bRst)
            {
                fi += float.Parse(textBox_OldBalance.Text);
                textBox_NewBalance.Text = fi.ToString("0.00");

                // 写入数据库
                sSql = "INSERT INTO rec_user (Card_No, Oper_Time, Oper_Type,Oper_SubType, Before_Val, Chg_Val, After_Val, Oper_ID, Tmn_ID, Sys_ID) VALUE(" +
                       "'" + textBox_CardID.Text + "'," +
                       "'" + dTradeTime.ToString("yyyy-MM-dd HH:mm:ss") + "'," +
                       "'ADD','" + comboBox_Type.Text.Trim() + "',";
                float f = float.Parse(textBox_OldBalance.Text);
                f *= 100;
                int i = (int)(f + 0.5);
                sSql += i.ToString() + ",";

                f     = float.Parse(textBox_Value.Text);
                f    *= 100;
                i     = (int)(f + 0.5);
                sSql += i.ToString() + ",";

                f     = fi;
                f    *= 100;
                i     = (int)(f + 0.5);
                sSql += i.ToString() + "," +
                        MyStart.giUserID + "," +
                        "'" + frm_Main.POS_ID + "'," +
                        iReaderTradeID.ToString() + ")";

                int iRst = MyStart.oMyDb.WriteData(sSql, ref sErrMsg);
                if (iRst <= 0)
                {
                    textBox_Result.Text = "充值成功!但写数据库失败( " + sErrMsg + " )";
                }
                else
                {
                    textBox_Result.Text = "充值成功!";
                }

                // log
                MyFunc.WriteToDbLog("买方资金-充值", "买方卡号=" + textBox_CardID.Text + ",充值=" + textBox_Value.Text + "元,类型=" + comboBox_Type.Text.Trim() + ",时间 =" + dTradeTime.ToString("yyyy-MM-dd HH:mm:ss"), "MSG", MyStart.giUserID);

                //打印票据
                button_Print_Click(sender, e);
                button_Print_Click(sender, e);
            }
            else
            {
                textBox_Result.Text     = "充值失败 = szErr";
                textBox_NewBalance.Text = textBox_OldBalance.Text;
            }
            MyStart.oMyDb.Close();

            groupBox_SecondStep.Enabled = false;
            groupBox_ThirdStep.Visible  = true;

            button_Retry.Focus();
        }
Esempio n. 21
0
        private void button_Qry_Click(object sender, EventArgs e)
        {
            string szCard = textBox_Card.Text;

            if (szCard.Length == 15)
            {
                szCard = MyStart.gszCardFirmFirst + textBox_Card.Text;
            }

            MyFunc.WriteToDbLog("刷卡查询销售明细", "", "MSG", MyStart.giUserID);
            dataGridViewRst.Rows.Clear();
            MyFunc.GridInit(ref dataGridViewRst, mszTitle, mszTitleWidth, 15, miDefRows, true);
            if (MyStart.gszMrktName.Length > 0)
            {
                mszRptTitle = MyStart.gszMrktName + "销售明细表";
            }
            else
            {
                mszRptTitle = "销售明细表";
            }
            DataSet ds          = new DataSet();
            string  szWhere     = "";
            string  szDetailSql = "select a.sys_id,jy_tim,substring(a.store_card,2),user_card,prod_name,format(prod_up / 100, 2),"
                                  + "format(prod_w / 1000, 3),format(prod_nw / 1000, 3),"
                                  + "format((prod_w - prod_nw) / 1000, 3),format(prod_amount / 100, 2), "
                                  + "concat(format(MKT_BUYER_FEE_RATE/10,1),'%'),format(MKT_BUYER_FEE/ 100, 2), "
                                  + "concat(format(MKT_SELLER_FEE_RATE/10,1),'%'),format(MKT_SELLER_FEE/ 100, 2),"
                                  + "concat(format(YTB_BUYER_FEE_RATE/10,1),'%'),format(YTB_BUYER_FEE/ 100, 2), "
                                  + "concat(format(YTB_SELLER_FEE_RATE/10,1),'%'),format(YTB_SELLER_FEE/ 100, 2),"

                                  /*+ "concat(format((YTB_BUYER_FEE_RATE+YTB_SELLER_FEE_RATE)/10,1),'%'),"
                                   + "format((YTB_BUYER_FEE + YTB_SELLER_FEE)/ 100, 2), "*/
                                  + "format((prod_amount + MKT_BUYER_FEE + MKT_SELLER_FEE + YTB_BUYER_FEE + YTB_SELLER_FEE)/ 100, 2)";

            mszSumSql = "select '合计','-','-','-','-','-',"
                        + "format(sum(prod_w) / 1000, 3),format(sum(prod_nw) / 1000, 3),"
                        + "format(sum(prod_w - prod_nw) / 1000, 3),format(sum(prod_amount) / 100, 2), "
                        + "'-',format(sum(MKT_BUYER_FEE)/ 100, 2), "
                        + "'-',format(sum(MKT_SELLER_FEE)/ 100, 2),"
                        + "'-',format(sum(YTB_BUYER_FEE)/ 100, 2), "
                        + "'-',format(sum(YTB_SELLER_FEE)/ 100, 2), "
                        + "format(sum(prod_amount + MKT_BUYER_FEE + MKT_SELLER_FEE + YTB_BUYER_FEE + YTB_SELLER_FEE)/ 100, 2)";

            szWhere = " from rec_trade a, base_prod b,mng_card c,base_store e,sys_msg f  "
                      + " where a.CANCEL_MARK='N' and a.STORE_CARD=c.STORE_CARD and c.STORE_ID=e.STORE_ID"
                      + " and a.PROD_ID = b.PROD_ID and b.PROD_LEVEL=1 and a.MSG_ID=f.MSG_ID";
            szWhere += " and jy_tim>='" + string.Format("{0:yyyy-MM-dd HH:mm:ss}", dateTimePicker_Bgn.Value) + "' "; // + " 00:00:00' ";
            szWhere += " and jy_tim<='" + string.Format("{0:yyyy-MM-dd HH:mm:ss}", dateTimePicker_End.Value) + "' "; // + " 23:59:59' ";
            //szWhere += " and jy_tim>='" + string.Format("{0:yyyy-MM-dd}", dateTimePicker_Bgn.Value) + " 00:00:00' ";
            //szWhere += " and jy_tim<='" + string.Format("{0:yyyy-MM-dd}", dateTimePicker_End.Value) + " 23:59:59' ";
            //验卡
            string szSql = "select user_card from base_ucard where user_card='" + szCard + "'";
            string szErr = "";

            try
            {
                int iRst = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                if (iRst != 0)
                {
                    MessageBox.Show("卡片查询失败,请换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog("刷卡查询商品交易明细信息", "SQL=" + szSql + ",Err=" + szErr);
                    goto Eend;
                }
                int iNum = ds.Tables[0].Rows.Count;
                if (iNum > 0)//买方卡
                {
                    if (DialogResult.No == MessageBox.Show("是否查询买方卡" + szCard + "的交易明细?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                    {
                        goto Eend;
                    }
                    szWhere += " and a.user_card='" + szCard + "' ";
                }
                else
                {
                    szSql = "select a.STORE_ID,CARD_TYPE,STORE_NAME from mng_card a,base_store b "
                            + "where a.STORE_ID=b.STORE_ID and STORE_CARD = '" + szCard + "'";
                    iRst = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                    if (iRst != 0)
                    {
                        MessageBox.Show("卡片查询失败,请换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MyIniFile.WriteLog("刷卡查询商品交易明细信息", "SQL=" + szSql + ",Err=" + szErr);
                        goto Eend;
                    }
                    iNum = ds.Tables[0].Rows.Count;
                    if (iNum == 0)
                    {
                        MessageBox.Show("系统中无此卡号,请换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MyIniFile.WriteLog("刷卡查询商品交易明细信息", "SQL=" + szSql + ",Err=系统中无此卡号");
                        goto Eend;
                    }
                    if (iNum > 1)
                    {
                        MessageBox.Show("系统中卡号重复记录,请换卡", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MyIniFile.WriteLog("刷卡查询商品交易明细信息", "SQL=" + szSql + ",Err=系统中卡号重复记录");
                        goto Eend;
                    }
                    DataRow dr         = ds.Tables[0].Rows[0];
                    int     iFirmID    = Convert.ToInt16(dr[0]);
                    int     iCardType  = Convert.ToInt16(dr[1]);
                    string  szFirmName = dr[2].ToString();
                    if (iCardType == 2)//副卡
                    {
                        if (DialogResult.No == MessageBox.Show("是否查询卖方副卡" + textBox_Card.Text + "的交易明细?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                        {
                            goto Eend;
                        }
                        szWhere += " and a.STORE_CARD='" + szCard + "' ";
                    }
                    else
                    {
                        szSql = "select STORE_CARD from mng_card where STORE_ID=" + iFirmID + " and CARD_TYPE<3";
                        iRst  = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                        if (iRst != 0)
                        {
                            MessageBox.Show("查询卖方副卡失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            MyIniFile.WriteLog("查询卖方副卡信息", "SQL=" + szSql + ",Err=" + szErr);
                            goto Eend;
                        }
                        iNum = ds.Tables[0].Rows.Count;

                        szCard = "";
                        if (iNum > 0)
                        {
                            if (DialogResult.No == MessageBox.Show("是否查询卖方(" + szFirmName + ")的交易明细?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                            {
                                goto Eend;
                            }
                            szCard = "";
                            for (int i = 0; i < iNum; i++)
                            {
                                dr      = ds.Tables[0].Rows[i];
                                szCard += "'" + dr[0].ToString() + "'";
                                if ((i + 1) < iNum)
                                {
                                    szCard += ",";
                                }
                            }
                        }
                        szWhere += " and a.STORE_CARD in (" + szCard + ") ";
                    }
                }

                szDetailSql = szDetailSql + szWhere + " order by jy_tim desc";
                if (mszSumSql.Length > 0)
                {
                    mszSumSql += szWhere;
                }

                iRst = MyStart.oMyDb.ReadData(szDetailSql, "tableA", ref ds, ref szErr);
                if (iRst != 0)
                {
                    MessageBox.Show("查询失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog("查询商品交易明细信息", "SQL=" + szDetailSql + ",Err=" + szErr);
                    goto Eend;
                }

                DataTable dt = ds.Tables[0];
                mDt  = dt;
                iNum = dt.Rows.Count;
                if (iNum == 0)
                {
                    MessageBox.Show("没有数据", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }
                int iCurNum = (iNum < miDefRows ? miDefRows : iNum);
                MyFunc.GridWriteDt(ref dataGridViewRst, ref dt, 0, miCols, ref iCurNum);
                miRows             = iNum;
                mszRptDate         = string.Format("{0:yyyy-MM-dd}", dateTimePicker_Bgn.Value) + " 至 " + string.Format("{0:yyyy-MM-dd}", dateTimePicker_End.Value);
                button_Rpt.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("查询失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
Eend:
            MyStart.oMyDb.Close();
        }
Esempio n. 22
0
        private void button_Qry_Click(object sender, EventArgs e)
        {
            MyFunc.WriteToDbLog("查询发卡明细", "", "MSG", MyStart.giUserID);

            dataGridView_Detail.Columns.Clear();
            dataGridView_Detail.DataSource = null;
            MyFunc.GridInit(ref dataGridView_Detail, mszTitle, mszTitleWidth, 15, miDefRows, true);

            int iFirmNum = comboBox_Firm.Items.Count - 1;

            string[] szFirmID = new string[iFirmNum];
            //string[] szFirmName = new string[iFirmNum];
            string[] szFirmCard  = new string[iFirmNum];
            int      iBgnRow     = 0;
            int      iCardNum    = 0;
            int      iAllCardNum = 0;
            int      iCurLine    = 0;
            bool     bHasCard    = false;
            int      iDoFirm     = 0;

            dataGridView_Detail.Rows.Clear();
            MyFunc.GridInit(ref dataGridView_Detail, mszTitle, mszTitleWidth, 15, miDefRows, true);
            if (comboBox_Firm.SelectedIndex == 0)//all
            {
                //2)get STORE_CARD
                for (int i = 0; i < iFirmNum; i++)
                {
                    string[] szItem = comboBox_Firm.Items[i + 1].ToString().Split('-');
                    szFirmID[i] = szItem[0];
                    //szFirmName[i] = szItem[1];
                    szFirmCard[i] = Get_STORE_CARD(szFirmID[i], "");
                    //if(Convert.ToInt16( szFirmID[i])>160)
                    //{
                    //    ;
                    //}
                    //3)get data
                    iCardNum = 0;
                    bHasCard = false;
                    if (szFirmCard[i].Trim().Length > 16)
                    {
                        WriteDataToGrid(comboBox_Firm.Items[i + 1].ToString(), szFirmCard[i], "", ref iBgnRow, ref iCardNum, ref bHasCard);
                    }
                    if (bHasCard)
                    {
                        iDoFirm++;
                    }
                    iAllCardNum += iCardNum;
                    //iCurLine += iCardNum + 1;
                }
                DataTable dt = new DataTable();
                for (int i = 0; i < miCols; i++)
                {
                    dt.Columns.Add(i.ToString(), Type.GetType("System.String"));
                }
                dt.Rows.Add(new object[] { "合计 " + iDoFirm + " 卖方已发卡", "", "", "发卡总数 " + iAllCardNum + " 张", "", "", "", "", "" });

                //int iRtnNum = iCurLine;
                MyFunc.GridWriteDt(ref dataGridView_Detail, ref dt, iBgnRow, miCols, ref iCurLine);
                groupBox3.Text = "发卡明细:总卖方数 " + iFirmNum + " 户,已发卡卖方 " + iDoFirm + " 户,发卡总数 " + iAllCardNum + " 张";
            }
            else//only one firm
            {
                if (comboBox_Stall.SelectedIndex == 0)//all
                {//2)get STORE_CARD
                    string[] szItem = comboBox_Firm.Items[comboBox_Firm.SelectedIndex].ToString().Split('-');
                    szFirmID[0] = szItem[0];
                    //szFirmName[0] = szItem[1];
                    szFirmCard[0] = Get_STORE_CARD(szFirmID[0], "");
                    //3)get data
                    iCardNum = 0;
                    if (szFirmCard[0].Trim().Length > 0)
                    {
                        WriteDataToGrid(comboBox_Firm.Items[comboBox_Firm.SelectedIndex].ToString(), szFirmCard[0], "", ref iBgnRow, ref iCardNum, ref bHasCard);
                    }

                    groupBox3.Text = "发卡明细:该卖方发卡总数 " + iCardNum + " 张";
                }
                else
                {
                    string[] szItem = comboBox_Firm.Items[comboBox_Firm.SelectedIndex].ToString().Split('-');
                    szFirmID[0] = szItem[0];
                    string[] szX      = comboBox_Stall.Items[comboBox_Stall.SelectedIndex].ToString().Split('-');
                    string   szRentID = szX[0];
                    //szFirmName[0] = szItem[1];
                    szFirmCard[0] = Get_STORE_CARD(szFirmID[0], szRentID);
                    //3)get data
                    iCardNum = 0;
                    if (szFirmCard[0].Trim().Length > 0)
                    {
                        WriteDataToGrid(comboBox_Firm.Items[comboBox_Firm.SelectedIndex].ToString(), szFirmCard[0], "", ref iBgnRow, ref iCardNum, ref bHasCard);
                    }

                    groupBox3.Text = "发卡明细:该档口发卡总数 " + iCardNum + " 张";
                }
            }
            if (dataGridView_Detail.RowCount > 0)
            {
                button_Rpt.Enabled = true;
            }
            miRows = iBgnRow + 1;
        }
Esempio n. 23
0
        private void button_Qry_Click(object sender, EventArgs e)
        {
            MyFunc.WriteToDbLog("查询买方交易汇总", "", "MSG", MyStart.giUserID);
            string szBgn = string.Format("{0:yyyy-MM-dd HH:mm:ss}", dateTimePicker_Bgn.Value);
            string szEnd = string.Format("{0:yyyy-MM-dd  HH:mm:ss}", dateTimePicker_End.Value);

            dataGridViewRst.Rows.Clear();
            MyFunc.GridInit(ref dataGridViewRst, mszTitle, mszTitleWidth, 15, miDefRows, true);
            if (MyStart.gszMrktName.Length > 0)
            {
                mszRptTitle = MyStart.gszMrktName + "买方交易汇总表";
            }
            else
            {
                mszRptTitle = "买方交易汇总表";
            }

            string  szDateCondition = "jy_tim>='" + szBgn + "' and jy_tim<='" + szEnd + "'";
            DataSet ds = new DataSet();

            int iFirmNum = comboBox_Firm.Items.Count - 1;

            string[] szFirmID   = new string[iFirmNum]; //user card id
            string[] szFirmName = new string[iFirmNum];
            string[] szFirmCard = new string[iFirmNum]; //user card id
            int      iBgnRow    = 0;

            try
            {
                if (radioButton_Sel.Checked)
                {
                    if (comboBox_Firm.SelectedIndex == 0)//all
                    {
                        //2)get STORE_CARD
                        for (int i = 0; i < iFirmNum; i++)
                        {
                            string[] szItem = comboBox_Firm.Items[i + 1].ToString().Split('-');
                            szFirmID[i]   = szItem[0];
                            szFirmName[i] = szItem[1];
                            szFirmCard[i] = szFirmID[i];
                            //3)get data
                            if (szFirmCard[i].Trim().Length > 0)
                            {
                                WriteDataToGrid(szFirmName[i], szFirmCard[i], szDateCondition, ref iBgnRow);
                            }
                        }
                    }
                    else//only one firm
                    {
                        //2)get STORE_CARD
                        string[] szItem = comboBox_Firm.Items[comboBox_Firm.SelectedIndex].ToString().Split('-');
                        szFirmID[0]   = szItem[0];
                        szFirmName[0] = szItem[1];
                        szFirmCard[0] = szFirmID[0];
                        //3)get data
                        if (szFirmCard[0].Trim().Length > 0)
                        {
                            WriteDataToGrid(szFirmName[0], szFirmCard[0], szDateCondition, ref iBgnRow);
                        }
                    }
                }
                if (radioButton_Input.Checked)
                {
                    szFirmID[0]   = textBox_Card.Text.Trim();
                    szFirmCard[0] = szFirmID[0];
                    //check card and get name
                    string szSql = "select user_name from base_ucard where user_card='" + szFirmCard[0] + "'";
                    string szErr = "";
                    int    iRst  = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                    if (iRst != 0)
                    {
                        MessageBox.Show("查询买方卡失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MyIniFile.WriteLog("查询买方卡信息", "SQL=" + szSql + ",Err=" + szErr);
                        goto Eend;
                    }
                    int iNum = ds.Tables[0].Rows.Count;
                    if (iNum == 0)
                    {
                        MessageBox.Show("系统里无此买方卡,请换卡!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MyIniFile.WriteLog("查询买方卡信息", "SQL=" + szSql + ",Err=系统里无此买方卡");
                        goto Eend;
                    }
                    if (iNum > 1)
                    {
                        MessageBox.Show("重复发卡,请换卡!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MyIniFile.WriteLog("查询买方卡信息", "SQL=" + szSql + ",Err=重复发卡");
                        goto Eend;
                    }
                    DataRow dr = ds.Tables[0].Rows[0];
                    szFirmName[0] = dr[0].ToString();

                    //3)get data
                    if (szFirmCard[0].Trim().Length > 0)
                    {
                        WriteDataToGrid(szFirmName[0], szFirmCard[0], szDateCondition, ref iBgnRow);
                    }
                }
                if (radioButton_name.Checked)
                {
                    szFirmID[0]   = textBox_Card.Text.Trim();
                    szFirmCard[0] = szFirmID[0];
                    //check card and get name
                    string szSql = "select user_card,user_name from base_ucard where user_name like '%" + textBox_name.Text + "%'";
                    string szErr = "";
                    int    iRst  = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                    if (iRst != 0)
                    {
                        MessageBox.Show("查询买方卡失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MyIniFile.WriteLog("查询买方卡信息", "SQL=" + szSql + ",Err=" + szErr);
                        goto Eend;
                    }
                    iFirmNum = ds.Tables[0].Rows.Count;
                    if (iFirmNum == 0)
                    {
                        MessageBox.Show("系统里无此买方卡,请换卡!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MyIniFile.WriteLog("查询买方卡信息", "SQL=" + szSql + ",Err=系统里无此买方卡");
                        goto Eend;
                    }
                    for (int i = 0; i < iFirmNum; i++)
                    {
                        DataRow  dr     = ds.Tables[0].Rows[i];
                        string[] szItem = comboBox_Firm.Items[i + 1].ToString().Split('-');
                        szFirmID[i]   = dr[0].ToString();
                        szFirmName[i] = dr[1].ToString();
                        szFirmCard[i] = szFirmID[i];
                        //3)get data
                        if (szFirmCard[i].Trim().Length > 0)
                        {
                            WriteDataToGrid(szFirmName[i], szFirmCard[i], szDateCondition, ref iBgnRow);
                        }
                    }
                }

                if (iBgnRow == 0)
                {
                    MessageBox.Show("没有数据", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }
                miRows             = iBgnRow;
                mszRptDate         = szBgn + " 至 " + szEnd;
                button_Rpt.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("查询失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
Eend:
            MyStart.oMyDb.Close();
        }
Esempio n. 24
0
        private void button_Save_Click(object sender, EventArgs e)
        {
            if (DialogResult.No == MessageBox.Show("请确认要保存该卖方信息", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information))
            {
                MessageBox.Show("取消当前保存操作", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            string szSql;
            string szTitle;
            string szErr = "";
            int    iRst;

            string[] szItem = comboBox_Cert.Text.Split(',');
            try
            {
                if (IsNew)// textBox_Name.Enabled)//add
                {
                    szTitle = "卖方基本信息-新增";
                    if (textBox_Cert.TextLength == 0)
                    {
                        MessageBox.Show("请输入卖方联系人身份证号", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        textBox_Cert.SelectAll();
                        textBox_Cert.Focus();
                        return;
                    }
                    if (textBox_Cell.TextLength == 0)
                    {
                        MessageBox.Show("请输入卖方联系电话", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        textBox_Cell.SelectAll();
                        textBox_Cell.Focus();
                        return;
                    }
                    szSql = "select * from base_store where STORE_NAME='" + textBox_Name.Text.Trim() + "'";
                    DataSet ds = new DataSet();
                    iRst = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                    if (iRst < 0)
                    {
                        MessageBox.Show("查询信息出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",Err=" + szErr);
                        goto Eend;
                    }
                    if (ds.Tables[0].Rows.Count == 1)
                    {
                        MessageBox.Show("卖方名称不能重复,请重新输入", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",Err=卖方名称不能重复,请重新输入");
                        textBox_Name.SelectAll();
                        textBox_Name.Focus();
                        goto Eend;
                    }

                    szSql = "INSERT INTO base_store(STORE_NAME,STORE_ADDR,STORE_BOSS,STORE_TEL,CERT_TYPE,CERT_ID,CERT_VALID,"
                            + "STORE_PERSON,STORE_CELL,STORE_TYPE,CITY,RMRK,STORE_STAT) VALUES "
                            + "('" + textBox_Name.Text.Trim() + "','" + textBox_Addr.Text.Trim() + "','"
                            + textBox_Boss.Text.Trim() + "','" + textBox_Cell.Text.Trim() + "',"
                            + Convert.ToInt16(szItem[0]) + ",'" + textBox_Cert.Text.Trim() + "','" + dateTimePicker_valid.Value + "','"
                            + textBox_Person.Text.Trim() + "','" + textBox_Cell.Text.Trim() + "',"
                            + comboBox_Type.SelectedIndex + 1 + ",'ZHONGSHAN','" + textBox_Desc.Text.Trim() + "','USED')";
                }
                else//edit
                {
                    szTitle = "卖方基本信息-修改";
                    szSql   = "UPDATE base_store set STORE_ADDR = '" + textBox_Addr.Text.Trim()
                              + "',STORE_NAME = '" + textBox_Name.Text.Trim()
                              + "',STORE_BOSS = '" + textBox_Boss.Text.Trim()
                              + "',STORE_TEL = '" + textBox_Cell.Text.Trim()
                              + "',CERT_TYPE = " + Convert.ToInt16(szItem[0])
                              + ",CERT_ID = '" + textBox_Cert.Text.Trim()
                              + "',CERT_VALID = '" + dateTimePicker_valid.Value
                              + "',STORE_PERSON = '" + textBox_Person.Text.Trim()
                              + "',STORE_CELL = '" + textBox_Cell.Text.Trim()
                              + "',STORE_TYPE = " + (comboBox_Type.SelectedIndex + 1)
                              + ",RMRK = '" + textBox_Desc.Text.Trim()
                              + "' WHERE STORE_ID=" + textBox_Code.Text.Trim();
                }
                iRst = MyStart.oMyDb.WriteData(szSql, ref szErr);
                if (iRst < 1)
                {
                    MessageBox.Show("保存出错(错误原因:" + szErr + ")", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",Err=" + szErr);
                }
                else
                {
                    szSql = "编号" + textBox_Code.Text + "-卖方名" + textBox_Name.Text;
                    MyFunc.WriteToDbLog(szTitle, szSql, "MSG", MyStart.giUserID);

                    MessageBox.Show("保存成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    GridDataRefresh();
                    //dataGridView1.Refresh();
                    MyIniFile.WriteLog(szTitle, "SQL=" + szSql + ",OK");
                }
                groupBoxInf.Enabled  = false;
                groupBoxList.Enabled = true;

                textBox_Code.Text         = mszCode;
                textBox_Name.Text         = mszName;
                textBox_Addr.Text         = mszAddr;
                textBox_Boss.Text         = mszBoss;
                comboBox_Cert.Text        = mszCertType;
                textBox_Cert.Text         = mszCert;
                dateTimePicker_valid.Text = mszValid;
                textBox_Person.Text       = mszPerson;
                textBox_Cell.Text         = mszCell;
                comboBox_Type.Text        = mszType;
                textBox_Desc.Text         = mszInf;
            }
            catch (Exception ex)
            {
                MessageBox.Show("保存失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
Eend:
            MyStart.oMyDb.Close();
        }
Esempio n. 25
0
        private void button_Qry_Click(object sender, EventArgs e)
        {
            MyFunc.WriteToDbLog("查询商品销售汇总", "", "MSG", MyStart.giUserID);
            string szBgn = string.Format("{0:yyyy-MM-dd HH:mm:ss}", dateTimePicker_Bgn.Value);
            string szEnd = string.Format("{0:yyyy-MM-dd  HH:mm:ss}", dateTimePicker_End.Value);

            dataGridViewRst.Rows.Clear();
            MyFunc.GridInit(ref dataGridViewRst, mszTitle, mszTitleWidth, 15, miDefRows, true);
            if (MyStart.gszMrktName.Length > 0)
            {
                mszRptTitle = MyStart.gszMrktName + "商品销售汇总表";
            }
            else
            {
                mszRptTitle = "商品销售汇总表";
            }

            string  szDateCondition = "jy_tim>='" + szBgn + "' and jy_tim<='" + szEnd + "'";
            DataSet ds = new DataSet();

            int iFirmNum = comboBox_Firm.Items.Count - 1;

            string[] szFirmID   = new string[iFirmNum]; //prod id
            string[] szFirmName = new string[iFirmNum];
            string[] szFirmCard = new string[iFirmNum]; //prod id
            int      iBgnRow    = 0;

            try
            {
                if (comboBox_Firm.SelectedIndex == 0)//all
                {
                    //2)get STORE_CARD
                    for (int i = 0; i < iFirmNum; i++)
                    {
                        string[] szItem = comboBox_Firm.Items[i + 1].ToString().Split('-');
                        szFirmID[i]   = szItem[0];
                        szFirmName[i] = szItem[1];
                        szFirmCard[i] = szFirmID[i];
                        //3)get data
                        if (szFirmCard[i].Trim().Length > 0)
                        {
                            WriteDataToGrid(szFirmName[i], szFirmCard[i], szDateCondition, ref iBgnRow);
                        }
                    }
                    WriteSumToGrid(szDateCondition, ref iBgnRow);
                }
                else//only one firm
                {
                    //2)get STORE_CARD
                    string[] szItem = comboBox_Firm.Items[comboBox_Firm.SelectedIndex].ToString().Split('-');
                    szFirmID[0]   = szItem[0];
                    szFirmName[0] = szItem[1];
                    szFirmCard[0] = szFirmID[0];
                    //3)get data
                    if (szFirmCard[0].Trim().Length > 0)
                    {
                        WriteDataToGrid(szFirmName[0], szFirmCard[0], szDateCondition, ref iBgnRow);
                    }
                }

                if (iBgnRow == 0)
                {
                    MessageBox.Show("没有数据", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }
                miRows             = iBgnRow;
                mszRptDate         = szBgn + " 至 " + szEnd;
                button_Rpt.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("查询失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
Eend:
            MyStart.oMyDb.Close();
        }
Esempio n. 26
0
        //string sStoreCardID = "";

        private void button_Find_Click(object sender, EventArgs e)
        {
            string T1   = "";
            string T2   = "";
            string sSql = "";

            if (dateTimePicker1.Value <= dateTimePicker2.Value)
            {
                T1 = dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss");
                T2 = dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm:ss");
            }
            else
            {
                T2 = dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm:ss");
                T1 = dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm:ss");
            }

            if (mszFlag.ToUpper() == "USER_CARD")
            {
                sSql = "SELECT * FROM rec_user WHERE Card_No = '" + textBox_CardID.Text + "'";
            }
            else
            {
                sSql = "SELECT * FROM rec_firm WHERE Store_ID = " + sStoreID;
            }
            sSql += " AND Oper_Time BETWEEN '" + T1 + "' AND '" + T2 + "' ORDER BY ID Desc";

            DataSet odt     = null;
            string  sErrMsg = "";
            string  sTmp    = "";

            int iRt = MyStart.oMyDb.ReadData(sSql, "TableA", ref odt, ref sErrMsg);

            if (iRt != 0)
            {
                MessageBox.Show("查询数据库时出现错误 = " + sErrMsg, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                goto Eend;
            }

            int   iValue       = 0;
            int   iTradeNum    = 0;
            int   iTradeAmount = 0;
            float fi           = 0;

            miRows = odt.Tables[0].Rows.Count;

            if (odt.Tables[0].Rows.Count == 0)
            {   // 没有数据
                button_Print.Enabled = false;
            }
            else
            {   // 已检索到数据
                for (int i = 0; i < odt.Tables[0].Rows.Count; i++)
                {
                    dataGridView1.Rows.Add();
                    dataGridView1.Rows[i].Cells[1].Value = odt.Tables[0].Rows[i]["Oper_Time"].ToString().Trim();

                    sTmp   = odt.Tables[0].Rows[i]["Chg_Val"].ToString().Trim();
                    iValue = int.Parse(sTmp);
                    fi     = iValue;
                    fi    /= 100;
                    dataGridView1.Rows[i].Cells[3].Value = fi.ToString("0.00");

                    sTmp = odt.Tables[0].Rows[i]["Oper_Type"].ToString().Trim();
                    switch (sTmp)
                    {
                    case "ADD":
                        sTmp          = "充值";
                        iTradeAmount += iValue;
                        break;

                    case "TRADE":
                        sTmp = "消费";
                        if (mszFlag.ToUpper() == "USER_CARD")
                        {
                            iTradeAmount -= iValue;
                        }
                        else
                        {
                            iTradeAmount += iValue;
                        }
                        break;

                    case "CASH":
                        sTmp          = "取款";
                        iTradeAmount -= iValue;        // 大家都是减少
                        break;

                    case "CHG":
                        sTmp          = "换卡";
                        iTradeAmount -= iValue;         // 大家都是减少
                        break;

                    case "SETT":
                        sTmp = "结算";
                        break;

                    case "CANC":
                        sTmp = "撤销";
                        dataGridView1.Rows[i].Cells[0].Value = odt.Tables[0].Rows[i]["Rmrk"].ToString().Trim();
                        if (mszFlag.ToUpper() == "USER_CARD")
                        {
                            iTradeAmount += iValue;
                        }
                        else
                        {
                            iTradeAmount -= iValue;
                        }
                        break;
                    }
                    dataGridView1.Rows[i].Cells[2].Value = sTmp;

                    if (mszFlag.ToUpper() == "USER_CARD")
                    {
                        dataGridView1.Rows[i].Cells[0].Value = odt.Tables[0].Rows[i]["Card_No"].ToString().Trim();
                    }
                    else
                    {
                        if (sTmp == "消费")
                        {
                            dataGridView1.Rows[i].Cells[0].Value = odt.Tables[0].Rows[i]["Rmrk"].ToString().Trim();
                        }
                        else
                        {
                            dataGridView1.Rows[i].Cells[0].Value = odt.Tables[0].Rows[i]["Card_No"].ToString().Trim();
                        }
                    }

                    iTradeNum++;

                    sTmp   = odt.Tables[0].Rows[i]["After_Val"].ToString().Trim();
                    iValue = int.Parse(sTmp);
                    fi     = iValue;
                    fi    /= 100;
                    dataGridView1.Rows[i].Cells[4].Value = fi.ToString("0.00");
                }

                dataGridView1.Rows.Add();
                dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0].Value = "合计";
                //textBox_TradeNum.Text = iTradeNum.ToString();
                dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[2].Value = iTradeNum.ToString() + "笔";

                fi  = iTradeAmount;
                fi /= 100;
                //textBox_TradeAmount.Text = fi.ToString("0.00");
                dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[3].Value = fi.ToString("0.00");
                dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[1].Value = " ";
                dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[4].Value = " ";
                miRows++;
                dataGridView1.Rows[0].Selected = true;

                button_Print.Enabled = true;
            }

            // log
            if (mszFlag.ToUpper() == "USER_CARD")
            {
                MyFunc.WriteToDbLog("买方资金-资金变化查询", " ", "MSG", MyStart.giUserID);
            }
            else
            {
                MyFunc.WriteToDbLog("卖方资金-资金变化查询", " ", "MSG", MyStart.giUserID);
            }

            groupBox_3.Text    = "第三步:查询结果(合计 = " + iTradeNum.ToString() + " 笔,金额变化 = " + fi.ToString("0.00") + " 元)";
            groupBox_2.Enabled = false;
            groupBox_3.Visible = true;

Eend:
            MyStart.oMyDb.Close();
        }
Esempio n. 27
0
        private void button_Qry_Click(object sender, EventArgs e)
        {
            MyFunc.WriteToDbLog("查询市场交易汇总", "", "MSG", MyStart.giUserID);
            string szBgn = string.Format("{0:yyyy-MM-dd HH:mm:ss}", dateTimePicker_Bgn.Value);
            string szEnd = string.Format("{0:yyyy-MM-dd  HH:mm:ss}", dateTimePicker_End.Value);

            dataGridViewRst.Rows.Clear();
            MyFunc.GridInit(ref dataGridViewRst, mszTitle, mszTitleWidth, 15, miDefRows, true);
            if (MyStart.gszMrktName.Length > 0)
            {
                mszRptTitle = MyStart.gszMrktName + "交易汇总表";
            }
            else
            {
                mszRptTitle = "市场交易汇总表";
            }

            string szDateCondition = "jy_tim>='" + szBgn + "' and jy_tim<='" + szEnd + "'";
            string szSql           = "select '" + MyStart.gszMrktName + "',count(*), format(sum(prod_w - prod_nw) / 1000, 3),"
                                     + "format(sum(prod_amount) / 100, 2),format(sum(prod_amount) * 10 / sum(prod_w - prod_nw), 2),"
                                     + "format(sum(MKT_BUYER_FEE) / 100, 2), format(sum(MKT_SELLER_FEE) / 100, 2),"
                                     + "format(sum(MKT_BUYER_FEE + MKT_SELLER_FEE) / 100, 2), "
                                     + "format(sum(YTB_BUYER_FEE) / 100, 2), format(sum(YTB_SELLER_FEE) / 100, 2),"
                                     + "format(sum(YTB_BUYER_FEE + YTB_SELLER_FEE) / 100, 2), "
                                     + "format(sum(prod_amount + MKT_BUYER_FEE + MKT_SELLER_FEE + YTB_BUYER_FEE + YTB_SELLER_FEE) / 100, 2) "
                                     + "from rec_trade where CANCEL_MARK='N' and PROD_ID>0 and " + szDateCondition;
            string szErr = "";

            try
            {
                DataSet ds   = new DataSet();
                int     iRst = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                if (iRst != 0)
                {
                    MessageBox.Show("查询失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog("查询市场交易记录", "SQL=" + szSql + ",Err=" + szErr);
                    goto Eend;
                }
                DataTable dt   = ds.Tables[0];
                int       iNum = dt.Rows.Count;
                if (iNum == 0)
                {
                    goto Eend;
                }
                //mDt = dt;

                int iCurNum = (iNum < miDefRows ? miDefRows : iNum);
                int iBgnRow = 0;
                MyFunc.GridWriteDt(ref dataGridViewRst, ref dt, iBgnRow, miCols, ref iCurNum);
                iBgnRow += iNum;

                if (iBgnRow == 0)
                {
                    MessageBox.Show("没有数据", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }
                miRows             = iBgnRow;
                mszRptDate         = szBgn + " 至 " + szEnd;
                button_Rpt.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("查询失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
Eend:
            MyStart.oMyDb.Close();
        }
Esempio n. 28
0
        private void button_Qry_Click(object sender, EventArgs e)
        {
            //select
            //case when b.USER_NAME is not null then b.USER_NAME else '合计' end as '操作员',
            //case when oper_subtype is not null then oper_subtype else '小计' end as '类型',
            //sum(chg_val) as '金额' from rec_user a,sys_users b
            //where oper_type = 'ADD' and a.Oper_ID = b.USER_ID group by b.USER_NAME, oper_subtype with rollup;

            MyFunc.WriteToDbLog("查询充值汇总", "", "MSG", MyStart.giUserID);
            string szBgn = string.Format("{0:yyyy-MM-dd HH:mm:ss}", dateTimePicker_Bgn.Value);
            string szEnd = string.Format("{0:yyyy-MM-dd  HH:mm:ss}", dateTimePicker_End.Value);

            //dataGridViewRst.Rows.Clear();
            //MyFunc.GridInit(ref dataGridViewRst, mszTitle, mszTitleWidth, 15, miDefRows, true);
            if (MyStart.gszMrktName.Length > 0)
            {
                mszRptTitle = MyStart.gszMrktName + "充值汇总表";
            }
            else
            {
                mszRptTitle = "充值汇总表";
            }

            string szDateCondition = "Oper_Time>='" + szBgn + "' and Oper_Time<='" + szEnd + "'";
            string szSql           = "select "
                                     + "case when b.USER_NAME is not null then b.USER_NAME else '合计' end as '收银员',"
                                     + "case when oper_subtype is not null then oper_subtype else '小计' end as '充值类型',"
                                     + "count(chg_val) as 充值笔数,format(sum(chg_val) / 100, 2) as '充值金额(元)' from rec_user a,sys_users b where oper_type = 'ADD' and a.Oper_ID=b.USER_ID  ";

            if (comboBox_Type.SelectedIndex > 0)//only one type
            {
                szSql += " and oper_subtype='" + comboBox_Type.Text.Trim() + "' ";
            }
            if (comboBox_POS.SelectedIndex > 0)//only one oper
            {
                string[] szX = comboBox_POS.Text.Split('-');
                szSql += " and a.Oper_ID=" + szX[0];
            }
            if (!(textBox_buyer.Text.Length == 0 && comboBox_Buyer.SelectedIndex == 0))//only one buyer
            {
                string[] szX = comboBox_Buyer.Text.Split('-');
                szSql += " and a.Card_No='" + szX[0] + "' ";
            }
            szSql += " and " + szDateCondition + " group by b.USER_NAME, oper_subtype with rollup";
            try
            {
                DataSet ds    = new DataSet();
                string  szErr = "";
                int     iRst  = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                if (iRst != 0)
                {
                    MessageBox.Show("查询失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog("查询充值汇总", "SQL=" + szSql + ",Err=" + szErr);
                    goto Eend;
                }
                DataTable dt = ds.Tables[0];
                if (dataGridViewRst.Columns.Count > 0)
                {
                    dataGridViewRst.Columns.Clear();
                }
                dataGridViewRst.DataSource = dt;
                dataGridViewRst.Refresh();

                int iNum = dt.Rows.Count;
                if (iNum == 0)
                {
                    button_Rpt.Enabled = false;
                    MessageBox.Show("没有数据", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }

                int iCurNum = (iNum < miDefRows ? miDefRows : iNum);
                int iBgnRow = 0;
                //MyFunc.GridWriteDt(ref dataGridViewRst, ref dt, iBgnRow, miCols, ref iCurNum);
                iBgnRow += iNum;

                if (iBgnRow == 0)
                {
                    goto Eend;
                }


                miRows             = iBgnRow;
                mszRptDate         = szBgn + " 至 " + szEnd;
                button_Rpt.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("查询失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
Eend:
            MyStart.oMyDb.Close();
        }
Esempio n. 29
0
        private void button_Qry_Click(object sender, EventArgs e)
        {
            MyFunc.WriteToDbLog("查询取款汇总", "", "MSG", MyStart.giUserID);
            string szBgn = string.Format("{0:yyyy-MM-dd HH:mm:ss}", dateTimePicker_Bgn.Value);
            string szEnd = string.Format("{0:yyyy-MM-dd  HH:mm:ss}", dateTimePicker_End.Value);

            string szTable = "";

            if (MyStart.gszMrktName.Length > 0)
            {
                mszRptTitle = MyStart.gszMrktName + "";
            }
            else
            {
                mszRptTitle = "";
            }

            /*
             * if (radioButton_buyer.Checked)
             * {
             *  szTable = "rec_user";
             *  mszRptTitle += "买方";
             * }
             * if (radioButton_seller.Checked)
             * {
             *  szTable = "rec_firm";
             *  mszRptTitle += "卖方";
             * }*/
            mszRptTitle += "取款汇总表";

            string szDateCondition = "Oper_Time>='" + szBgn + "' and Oper_Time<='" + szEnd + "'";

            /*string szSql = "select "
             + "case when b.USER_NAME is not null then b.USER_NAME else '合计' end as '收银员',"
             + "case when oper_subtype is not null then oper_subtype else '小计' end as '取款类型',"
             + "count(chg_val) as 取款笔数,format(sum(chg_val) / 100, 2) as 取款金额(元) from " + szTable + " a,sys_users b where oper_type = 'CASH' and a.Oper_ID=b.USER_ID  ";
             +
             + if (comboBox_Type.SelectedIndex > 0)//only one type
             + {
             +  szSql += " and oper_subtype='" + comboBox_Type.Text.Trim() + "' ";
             + }
             + if (comboBox_POS.SelectedIndex > 0)//only one oper
             + {
             +  string[] szX = comboBox_POS.Text.Split('-');
             +  szSql += " and a.Oper_ID=" + szX[0];
             + }
             + if (!(textBox_buyer.Text.Length == 0 && comboBox_Buyer.SelectedIndex == 0))//only one buyer
             + {
             +  string[] szX = comboBox_Buyer.Text.Split('-');
             +  szSql += " and a.Card_No='" + szX[0] + "' ";
             + }
             + szSql += " and " + szDateCondition + " group by b.USER_NAME, oper_subtype with rollup";*/
            string szSql = "select "
                           + "case when Z.USER_NAME is not null then Z.USER_NAME else '合计' end as '收银员',"
                           + "case when X_TYPE is not null then X_TYPE else '小计' end as '取款类型',"
                           + "sum(A) as 卖方取款笔数,format(sum(B) / 100, 2) as '卖方取款金额(元)',sum(C) as 买方取款笔数,format(sum(D) / 100, 2) as '买方取款金额(元)',"
                           + "sum(A + C) as 取款总笔数, format(sum(B + D) / 100, 2) as '取款总金额(元)' "
                           + "from "
                           + "(select X_ID, X_TYPE, A, B, C, D from "
                           + " (select Oper_ID as X_ID, Oper_SubType as X_TYPE, count(Chg_Val) as A, sum(Chg_Val) as B from rec_firm where Oper_Type = 'CASH' and " + szDateCondition + " group by Oper_ID, Oper_SubType) X,"
                           + " (select Oper_ID as Y_ID, Oper_SubType as Y_TYPE, count(Chg_Val) as C, sum(Chg_Val) as D from rec_user where Oper_Type = 'CASH' and " + szDateCondition + " group by Oper_ID, Oper_SubType) Y "
                           + " where X_ID = Y_ID and X_TYPE = Y_TYPE"
                           + ") XX,sys_users Z where XX.X_ID = Z.USER_ID ";

            if (comboBox_POS.SelectedIndex > 0)//only one oper
            {
                string[] szX = comboBox_POS.Text.Split('-');
                szSql += " and Z.USER_ID=" + szX[0];
            }
            szSql += " group by Z.USER_NAME,XX.X_TYPE with rollup";
            try
            {
                DataSet ds    = new DataSet();
                string  szErr = "";
                int     iRst  = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                if (iRst != 0)
                {
                    MessageBox.Show("查询失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MyIniFile.WriteLog("查询取款汇总", "SQL=" + szSql + ",Err=" + szErr);
                    goto Eend;
                }
                DataTable dt = ds.Tables[0];
                if (dataGridViewRst.Columns.Count > 0)
                {
                    dataGridViewRst.Columns.Clear();
                }
                dataGridViewRst.DataSource = dt;
                dataGridViewRst.Refresh();

                int iNum = dt.Rows.Count;
                if (iNum == 0)
                {
                    button_Rpt.Enabled = false;
                    MessageBox.Show("没有数据", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }

                int iCurNum = (iNum < miDefRows ? miDefRows : iNum);
                int iBgnRow = 0;
                //MyFunc.GridWriteDt(ref dataGridViewRst, ref dt, iBgnRow, miCols, ref iCurNum);
                iBgnRow += iNum;

                if (iBgnRow == 0)
                {
                    goto Eend;
                }

                miRows             = iBgnRow;
                mszRptDate         = szBgn + " 至 " + szEnd;
                button_Rpt.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("查询失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
Eend:
            MyStart.oMyDb.Close();
        }
Esempio n. 30
0
        private void button_qry2_Click(object sender, EventArgs e)
        {
            MyFunc.WriteToDbLog("查询发卡明细", "", "MSG", MyStart.giUserID);

            dataGridView_Detail.Columns.Clear();
            dataGridView_Detail.DataSource = null;
            MyFunc.GridInit(ref dataGridView_Detail, mszTitle, mszTitleWidth, 15, miDefRows, true);

            string szWhere = "";

            if (radioButton_card.Checked)
            {
                szWhere += "STORE_CARD like '%" + textBox_Card.Text.Trim() + "%' ";
            }
            if (radioButton_cell.Checked)
            {
                szWhere += "a.USER_TEL like '%" + textBox_Cell.Text.Trim() + "%' ";
            }
            if (radioButton_name.Checked)
            {
                szWhere += "a.STORE_PERSON like '%" + textBox_name.Text.Trim() + "%' ";
            }
            if (radioButton_date.Checked)
            {
                szWhere += "DATE_FORMAT(a.ADD_DT, '%Y-%m-%d') = '" + dateTimePicker1.Value.ToString("yyyy-MM-dd") + "' ";
            }

            string szSql = "(SELECT store_name as 卖方名称,a.ADD_DT as 发卡时间, "
                           + "if (CARD_TYPE = 1,'第一副卡',if (CARD_TYPE = 2,'副卡','结算卡')) as 卡类,STORE_CARD as 卡号, "
                           + "if (CARD_STAT = 'BGN','正常',if (CARD_STAT = 'STOP','无效','挂失')) as 状态,STALL_INF as 档口信息, "
                           + "a.STORE_PERSON as 联系人,a.USER_TEL as 联系电话, a.cert_id as 身份证, b.USER_NAME as 开卡人 "
                           + "FROM mng_card a,sys_users b,base_store c where a.ADD_ID=b.USER_ID and a.STORE_ID=c.STORE_ID and " + szWhere + " order by a.ADD_DT) "
                           + "union "
                           + "(select '小计', '', '', count(*),  '','', '', '', '',  '' from mng_card a where " + szWhere + ")";

            try
            {
                string  szErr = "";
                DataSet ds    = new DataSet();
                int     iRst  = MyStart.oMyDb.ReadData(szSql, "tableA", ref ds, ref szErr);
                if (iRst != 0)
                {
                    goto Eend;
                }

                DataTable dt   = ds.Tables[0];
                int       iNum = dt.Rows.Count;

                dataGridView_Detail.Columns.Clear();//
                dataGridView_Detail.DataSource = dt;
                dataGridView_Detail.Refresh();

                if (iNum > 0)
                {
                    button_Rpt.Enabled = true;
                }
                else
                {
                    //groupBox3.Text = "发卡明细:";
                    button_Rpt.Enabled = false;
                }
                if (!radioButton_date.Checked)
                {
                    mszRptDate = "";
                }
                else
                {
                    mszRptDate = "发卡日期:" + dateTimePicker1.Value.ToString("yyyy-MM-dd");
                }
                miRows = iNum;
            }
            catch (Exception ex)
            {
                MessageBox.Show("买方卡开卡查询失败( " + ex.Message + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
Eend:
            MyStart.oMyDb.Close();

            if (dataGridView_Detail.RowCount > 0)
            {
                button_Rpt.Enabled = true;
            }
            //miRows = iBgnRow + 1;
        }