Ejemplo n.º 1
0
        /// <summary>
        /// ѡ�����ڴ�Ӫ��ϵͳ���س��ⵥ��
        /// </summary>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public bool GetOutBill(string startDate, string endDate, string EmployeeCode, out string errorInfo, string wareCode, string billType)
        {
            bool tag = true;
            Employee = EmployeeCode;
            errorInfo = string.Empty;
            using (PersistentManager dbpm = new PersistentManager())
            {
                DownOutBillDao dao = new DownOutBillDao();
                DataTable emply = dao.FindEmployee(EmployeeCode);
                DataTable outBillNoTable = this.GetOutBillNo(startDate);
                string outBillList = UtinString.MakeString(outBillNoTable, "bill_no");
                outBillList = string.Format("ORDER_DATE ='{0}' AND ORDER_ID NOT IN({1}) ", startDate, outBillList);
                DataTable masterdt = this.GetOutBillMaster(outBillList);

                string outDetailList = UtinString.MakeString(masterdt, "ORDER_ID");
                outDetailList = "ORDER_ID IN(" + outDetailList + ")";
                DataTable detaildt = this.GetOutBillDetail(outDetailList);

                if (masterdt.Rows.Count > 0 && detaildt.Rows.Count > 0)
                {
                    try
                    {
                        string billno = this.GetNewBillNo();
                        DataSet middleds = this.MiddleTable(masterdt,billno);
                        //DataSet masterds = this.OutBillMaster(masterdt, emply.Rows[0]["employee_id"].ToString(), wareCode, billType);
                        DataSet detailds = this.OutBillDetail(detaildt, emply.Rows[0]["employee_id"].ToString(), wareCode, billType, startDate,billno);
                        this.Insert(detailds, middleds);
                    }
                    catch (Exception e)
                    {
                        errorInfo += e.Message;
                        tag = false;
                    }
                }
                else
                {
                    errorInfo = "û�п����صij������ݣ�";
                    tag = false;
                }
            }
            return tag;
        }