public bool AuditBills(string userName, string billcode, string opinion, string type)
        {
            bool   flag    = false;
            string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string;
            string session = Session.SessionID.ToString();

            if (!cookies.Equals(session))
            {
                return(flag);//身份验证失败
            }
            MLogin.GetExeUname();
            TreatFee t = new TreatFee();

            if (type == "YES")
            {
                if (opinion.Trim() == "")
                {
                    t.BLANK_STR_2 = "同意!";
                }
                t.STATE = 10;//审核成功
            }
            else
            {
                t.STATE       = -1;                         //审核失败
                t.BLANK_STR_2 = opinion;                    //审核意见
            }
            t.AUDITDATE   = System.DateTime.Now.ToString(); //审核时间
            t.BLANK_STR_3 = userName;                       //审核人名字
            t.Updata("  and BILLCODE='" + billcode + "'  ");
            flag = true;
            return(flag);
        }
        public void AccountFee(string userName, string client, string code, string eating, string other, string person,
                               string traffic, string commission, string remark, string hisname, string hisphone, string note)
        {
            string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string;
            string session = Session.SessionID.ToString();

            if (!cookies.Equals(session))
            {
                return;//身份验证失败
            }
            MLogin.GetExeUname();
            TreatFee t = new TreatFee();

            t.BILLCODE = ScueFun.Code.BasicCode("TreatFee", "BILLCODE", "TF");
            t.CLIENT   = client;
            t.VBCODE   = code;//拜访单单号
            t.BILLMAN  = userName;
            t.EATING   = eating;
            t.OTHER    = other;
            t.PERSON   = person;

            t.NAME  = hisname;
            t.PHONE = hisphone;
            t.NOTE  = note;

            t.TRAFFIC     = traffic;
            t.COMMISSION  = commission; //佣金申请
            t.BLANK_STR_1 = remark;     //备注,说明
            t.CREATETIME  = SysTime.GetTime.ToString("yyyy-MM-dd HH:mm:ss");
            t.STATE       = 0;          //已提交
            t.Insert();
        }
        public List <FeeBill> FeeBills(string userName)
        {
            string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string;
            string session = Session.SessionID.ToString();

            if (!cookies.Equals(session))
            {
                return(null);//身份验证失败
            }
            MLogin.GetExeUname();
            List <FeeBill>  bills = new List <FeeBill>();
            TreatFee        t     = new TreatFee();
            List <TreatFee> list  = t.Select(" and BILLMAN='" + userName + "' order by id desc ");

            foreach (TreatFee tf in list)
            {
                FeeBill bill = new FeeBill();
                bill.billcode   = tf.BILLCODE;
                bill.billman    = tf.BILLMAN;
                bill.createtime = tf.CREATETIME;
                bill.state      = tf.STATE;
                if (bill.state == 0)
                {
                    bill.state_desc = "未审核";
                }
                else if (bill.state == 10)
                {
                    bill.state_desc = "审核通过";
                }
                else if (bill.state == -1)
                {
                    bill.state_desc = "审核失败";
                }
                bill.vbcode     = tf.VBCODE;
                bill.client     = tf.CLIENT;
                bill.eating     = tf.EATING;
                bill.other      = tf.OTHER;
                bill.person     = tf.PERSON;
                bill.traffic    = tf.TRAFFIC;
                bill.commission = tf.COMMISSION;
                bill.remark     = tf.BLANK_STR_1;
                bill.opinion    = tf.BLANK_STR_2;
                bills.Add(bill);
            }
            return(bills);
        }
Exemple #4
0
        public static int SignIn(string userName, string userId, double lng, double lat)
        {
            TreatFee        f   = new TreatFee();
            List <TreatFee> fee = f.Select(" and billman='" + userName + "' and VBCODE= '打卡申请'  and  left(createtime, 10) = CONVERT(varchar(10), GETDATE(), 120)  and state=10 order by id desc ");

            if (fee.Count > 0)
            {
                double   lng_kf = fee[0].KFLNG == null ? -1 : Convert.ToDouble(fee[0].KFLNG);
                double   lat_kf = fee[0].KFLAT == null ? -1 : Convert.ToDouble(fee[0].KFLAT);
                DateTime now    = System.DateTime.Now;

                if (MyGlobal.AERA_CHECK)//是否距离校验
                {
                    if (LngLatDis.GetDistance(lng, lat, lng_kf, lat_kf) > MyGlobal.VISITAERA)
                    {
                        return(-3);//距离超长
                    }
                }
                //else
                //{
                L_SIGN        s      = new L_SIGN();
                string        date_s = now.ToString("yyyy-MM-dd");
                List <L_SIGN> l      = s.Select(" AND USERID='" + userId + "'  AND  DATE='" + date_s + "'  ");
                if (l.Count <= 0)//今日无签到记录
                {
                    L_SIGN mm = new L_SIGN();
                    mm.USERID    = userId;
                    mm.TURENAME  = userName;
                    mm.DATE      = date_s;
                    mm.TIME_A    = SysTime.GetTime.ToString("yyyy-MM-dd HH:mm:ss");
                    mm.NAME_A    = fee[0].CLIENT;
                    mm.LAT_A     = lat.ToString();
                    mm.LNG_A     = lng.ToString();
                    mm.R_CODE_IN = fee[0].BILLCODE;
                    mm.Insert();
                    return(0);
                }
                else//今日记录已存在
                {
                    string sign_in  = l[0].TIME_A == null ? "" : l[0].TIME_A;
                    string sign_out = l[0].TIME_D == null ? "" : l[0].TIME_D;
                    if (sign_in.Trim() != "") //上班已签到
                    {
                        return(-4);           //已签到
                    }
                    else if (sign_out != "")
                    {
                        return(-5);//已签到下班
                    }
                    else
                    {
                        L_SIGN mm = new L_SIGN();
                        mm.TIME_A    = SysTime.GetTime.ToString("yyyy-MM-dd HH:mm:ss");
                        mm.NAME_A    = fee[0].CLIENT;
                        mm.LAT_A     = lat.ToString();
                        mm.LNG_A     = lng.ToString();
                        mm.R_CODE_IN = fee[0].BILLCODE;
                        mm.Updata(" and  id=" + l[0].ID);
                        return(0);
                    }
                }
            }
            else
            {
                return(-2);//没有任何单子
            }
        }
        public SignBill WtSignBill(string userName, string client, string remark)
        {
            string cookies = HttpContext.Current.Request.Cookies["guid"] == null ? "" : HttpContext.Current.Request.Cookies["guid"].Value as string;
            string session = Session.SessionID.ToString();

            if (!cookies.Equals(session))
            {
                return(null);//身份验证失败
            }
            MLogin.GetExeUname();
            SignBill sign = new SignBill();
            string   position = KFLocation.Get(client);
            string   lng = null, lat = null;

            if (position == "")          //该客户没有定位
            {
                if (MyGlobal.AERA_CHECK) //是否范围校验
                {
                    sign.status = -1;
                    return(sign);
                }
            }
            else if (position == "none")//不存在该用户
            {
                sign.status = -2;
                return(sign);
            }
            else
            {
            }
            if (MyGlobal.AERA_CHECK)  //是否范围校验
            {
                string[] strs_kf = position.Split(',');
                lng = strs_kf[0];
                lat = strs_kf[1];
            }
            else
            {
                lng = "";
                lat = "";
            }
            TreatFee        t    = new TreatFee();
            List <TreatFee> list = t.Select(" and VBCODE= '打卡申请'  and  left(createtime, 10) = CONVERT(varchar(10), GETDATE(), 120)   and billman='" + userName + "'  ");

            if (list.Count > 0)
            {
                sign.status = -3;
                return(sign);
            }

            t.BILLCODE    = ScueFun.Code.BasicCode("TreatFee", "BILLCODE", "TF");
            t.VBCODE      = "打卡申请";   //拜访单单号
            t.CLIENT      = client;   //客户名字
            t.BILLMAN     = userName; //申请人
            t.BLANK_STR_1 = remark;   //备注,说明
            t.KFLNG       = lng;
            t.KFLAT       = lat;
            t.CREATETIME  = SysTime.GetTime.ToString("yyyy-MM-dd HH:mm:ss"); //申请时间
            t.STATE       = 0;                                               //已提交
            t.Insert();
            sign.status = 0;

            return(sign);
        }