Example #1
0
        //销售流水
        List <Model.t_order_detail> IBLL.ISaleData.GetSaleFlow(string date1, string date2, string order_key, int page_no, int page_size, out int total)
        {
            total = 0;
            try
            {
                var d2  = Conv.ToDateTime(date2).AddDays(1).ToString("yyyy-MM-dd");
                var sql = "select * from t_order_detail where ifnull(approve_flag,'0')='1' and oper_date>='" + date1 + "' and oper_date<='" + d2 + "' and sheet_no like '" + order_key + "%' ";
                sql += "order by oper_date,sheet_no,flow_id asc limit " + (page_no - 1) * page_size + "," + page_size;

                var dt  = Program.db.ExecuteToTable(sql, null);
                var lst = new List <Model.t_order_detail>();
                foreach (DataRow dr in dt.Rows)
                {
                    var item = new Model.t_order_detail();
                    item.flow_id      = Conv.ToInt(dr["flow_id"].ToString());
                    item.sheet_no     = dr["sheet_no"].ToString();
                    item.amt          = Conv.ToDecimal(dr["amt"].ToString());
                    item.item_name    = dr["item_name"].ToString();
                    item.item_no      = dr["item_no"].ToString();
                    item.item_subno   = dr["item_subno"].ToString();
                    item.unit_no      = dr["unit_no"].ToString();
                    item.branch_no    = dr["branch_no"].ToString();
                    item.cus_no       = dr["cus_no"].ToString();
                    item.oper_date    = Conv.ToDateTime(dr["oper_date"].ToString());
                    item.qty          = Conv.ToDecimal(dr["qty"].ToString());
                    item.price        = Conv.ToDecimal(dr["price"].ToString());
                    item.cost_price   = Conv.ToDecimal(dr["cost_price"].ToString());
                    item.approve_flag = dr["approve_flag"].ToString();
                    item.source_price = Conv.ToDecimal(dr["source_price"].ToString());
                    item.discount     = Conv.ToDecimal(dr["discount"].ToString());
                    item.is_give      = dr["is_give"].ToString();
                    lst.Add(item);
                }

                sql = "select count(*) total from t_order_detail where ifnull(approve_flag,'0')='1' and oper_date>='" + date1 + "' and oper_date<='" + d2 + "' and sheet_no like '" + order_key + "%' ";
                dt  = Program.db.ExecuteToTable(sql, null);
                if (dt.Rows.Count > 0)
                {
                    total = Conv.ToInt(dt.Rows[0]["total"]);
                }
                return(lst);
            }
            catch (Exception ex)
            {
                Log.writeLog("SaleData->GetSaleFlow()", ex.ToString());
                throw ex;
            }
        }
Example #2
0
        void IBLL.ISaleData.Insert(Model.t_order_detail item, out int flow_id)
        {
            try
            {
                var sql = "select ifnull(max(flow_id),0)+1 as flow_id from t_order_detail where sheet_no='" + item.sheet_no + "' ";
                var dt  = Program.db.ExecuteToTable(sql, null);
                flow_id = 1;
                if (dt.Rows.Count > 0)
                {
                    flow_id = Conv.ToInt(dt.Rows[0]["flow_id"]);
                }

                sql  = "insert into t_order_detail values('" + flow_id + "','" + item.sheet_no + "','" + item.item_no + "','" + item.item_subno + "','" + item.item_name + "','" + item.unit_no + "'";
                sql += ",'" + item.oper_id + "','" + item.oper_date.ToString("yyyy-MM-dd HH:mm:ss") + "','" + item.qty + "','" + item.price + "','" + item.amt + "'";
                sql += ",'" + item.jh + "','" + item.cost_price + "','" + item.branch_no + "','" + item.cus_no + "','" + item.sup_no + "','0','0','" + item.oper_date.ToString("yyyy-MM-dd HH:mm:ss") + "'";
                sql += ",'" + item.oper_id + "','" + item.source_price + "','" + item.discount + "','" + item.is_give + "') ";
                Program.db.ExecuteScalar(sql, null);
            }
            catch (Exception ex)
            {
                Log.writeLog("SaleData->Insert()", ex.ToString(), null);
                throw ex;
            }
        }
Example #3
0
 public CellInfo(Rectangle rec, Model.t_order_detail item, string columnName)
 {
     this.rec        = rec;
     this.item       = item;
     this.columnName = columnName;
 }