/// <summary>
 /// 关联发票更新
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public int Update(DuiZhang obj)
 {
     try
     {
         int    count = 0;
         string sql   = "update jinchen.duizhang_info set invoice_index='{0}',invoice_time='{1}' where id={2}";
         sql   = string.Format(sql, obj.invoice_index, obj.invoice_time, obj.id);
         count = PostgreHelper.ExecuteNonQuery(sql);
         return(count);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#2
0
 public IActionResult ChangeInvoice(string[] idList, string invoice_index)
 {
     for (int i = 0; i < idList.Length; i++)
     {
         DuiZhang duiZhang = new DuiZhang();
         duiZhang.id            = Convert.ToInt32(idList[i]);
         duiZhang.invoice_index = invoice_index;
         duiZhang.invoice_time  = DateTime.Now;
         int flag = DZM.Update(duiZhang);
         if (flag == 0)
         {
             return(Json("fail"));
         }
     }
     return(Json("success"));
 }
 /// <summary>
 /// 插入
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public int Insert(DuiZhang obj)
 {
     try
     {
         string sql = "insert into jinchen.duizhang_info(sale_id,dz_index,dui_num,dui_price,dui_time,company_name," +
                      "order_name,unit,deliver_time,company_order_index,dui_all_price,invoice_index) values({0},'{1}',{2},{3},'{4}','{5}','{6}','{7}','{8}','{9}',{10},'{11}')";
         sql = string.Format(sql, obj.sale_id, obj.dz_index, obj.dui_num, obj.dui_price, obj.dui_time,
                             obj.company_name, obj.order_name, obj.unit, obj.deliver_time, obj.company_order_index, obj.dui_all_price, obj.invoice_index);
         int count = PostgreHelper.ExecuteNonQuery(sql);
         return(count);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        /// <summary>
        /// 单笔查询
        /// </summary>
        /// <returns></returns>
        public DuiZhang SelectById(int id)
        {
            try
            {
                DuiZhang obj = new DuiZhang();
                string   sql = null;
                sql = "select a.id,a.dz_index,a.dui_num,a.dui_price,a.dui_time,a.company_name,a.order_name,a.unit,a.dui_all_price,a.deliver_time,a.company_order_index,b.deliver_index " +
                      "from jinchen.duizhang_info a,jinchen.sale_info b where a.sale_id=b.id and a.id={0} ";
                sql = string.Format(sql, id);
                obj = PostgreHelper.GetSingleEntity <DuiZhang>(sql);

                return(obj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#5
0
        /// <summary>
        /// 编辑处理Excel导入的批量信息
        /// </summary>
        /// <returns></returns>
        public IActionResult EditHandleList()
        {
            int check = 0;

            string[] allList   = Convert.ToString(HttpContext.Request.Form["AllList"]).Split(',');
            int      rowLength = Convert.ToInt32(HttpContext.Request.Form["num"]) - 1;

            int all = 0;

            for (int i = 0; i < rowLength; i++)
            {
                string[] res = new string[11];
                Array.Copy(allList, i * 11, res, 0, 11);

                if (res[1] != "")
                {
                    DuiZhang duiZhang = new DuiZhang();

                    duiZhang.deliver_time  = Convert.ToDateTime(res[1]);
                    duiZhang.deliver_index = res[2];
                    duiZhang.company_name  = res[3];
                    duiZhang.order_index   = res[4];
                    duiZhang.order_name    = res[5] + res[6];
                    duiZhang.unit          = res[7];
                    duiZhang.dui_num       = Convert.ToDouble(res[8]);
                    duiZhang.dui_price     = Convert.ToDouble(res[9]);
                    duiZhang.dui_all_price = Convert.ToDouble(res[10]);
                    duiZhang.invoice_index = " ";

                    int count = DZM.Insert(duiZhang);
                    if (count > 0)
                    {
                        check++;
                    }
                    all++;
                }
            }
            string result = "共" + all + "笔数据,导入成功" + check + "笔数据";

            return(Json(result));
        }
示例#6
0
        /// <summary>
        /// 插入更新页面
        /// </summary>
        /// <returns></returns>
        public IActionResult PutInvoice()
        {
            try
            {
                int      count         = 0;
                bool     flag          = true;
                string[] dzId          = Convert.ToString(HttpContext.Request.Form["DZ_Id"]).Split(',');
                string   invoice_index = Convert.ToString(HttpContext.Request.Form["invoice_index"]);
                DuiZhang dz            = new DuiZhang();
                if (dzId.Length <= 1 && dzId[0] == "")
                {
                    return(Json("Fail"));
                }

                for (int i = 0; i < dzId.Length; i++)
                {
                    dz.id            = Convert.ToInt32(dzId[i]);
                    dz.invoice_index = invoice_index;
                    dz.invoice_time  = DateTime.Now.ToLocalTime();
                    count            = DZM.Update(dz);
                    if (count < 1)
                    {
                        flag = false;
                    }
                }

                if (flag)
                {
                    return(Json("Success"));
                }
                else
                {
                    return(Json("Fail"));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#7
0
        /// <summary>
        /// 插入更新页面
        /// </summary>
        /// <returns></returns>
        public IActionResult DuiZhang()
        {
            try
            {
                int      count    = 0;
                bool     flag     = true;
                string[] saleid   = Convert.ToString(HttpContext.Request.Form["Sale_Id"]).Split(',');
                string[] duinum   = Convert.ToString(HttpContext.Request.Form["Dui_Num"]).Split(',');
                string[] duiprice = Convert.ToString(HttpContext.Request.Form["Dui_Price"]).Split(',');
                string   dz_index = Convert.ToString(HttpContext.Request.Form["dz_index"]);
                DuiZhang dz       = new DuiZhang();
                if (saleid.Length <= 1 && saleid[0] == "")
                {
                    return(Json("Fail"));
                }

                for (int i = 0; i < saleid.Length; i++)
                {
                    dz.sale_id = Convert.ToInt32(saleid[i]);

                    Sale sale = SM.SelectById(Convert.ToInt32(saleid[i]));
                    dz.company_order_index = sale.company_order_index;
                    dz.company_name        = sale.deliver_company_head;
                    dz.order_name          = sale.order_name;
                    dz.unit          = sale.unit;
                    dz.dui_num       = Convert.ToDouble(duinum[i]);
                    dz.dui_price     = sale.deliver_price;
                    dz.dui_all_price = Convert.ToDouble(duiprice[i]);
                    dz.deliver_time  = sale.insert_time;
                    dz.dz_index      = dz_index;
                    dz.dui_time      = DateTime.Now.ToLocalTime();
                    count            = DZM.Insert(dz);
                    if (count < 1)
                    {
                        flag = false;
                    }
                    else
                    {
                        double dz_num    = sale.dz_num + Convert.ToDouble(duinum[i]);
                        int    id        = Convert.ToInt32(saleid[i]);
                        int    updateRes = SM.UpdateDZNum(dz_num, id);
                        if (updateRes < 1)
                        {
                            flag = false;
                        }
                    }
                }

                if (flag)
                {
                    return(Json("Success"));
                }
                else
                {
                    return(Json("Fail"));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public int Update(DuiZhang duiZhang)
        {
            int count = DZS.Update(duiZhang);

            return(count);
        }
        /// <summary>
        /// 插入
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public int Insert(DuiZhang obj)
        {
            int count = DZS.Insert(obj);

            return(count);
        }
        public DuiZhang SelectById(int id)
        {
            DuiZhang duiZhang = DZS.SelectById(id);

            return(duiZhang);
        }