Ejemplo n.º 1
0
 public static int InserData(Paper_In pi)
 {
     if (pi != null)
     {
         return(DataSource.ORMHelper.InsertModel <Paper_In>(pi));
     }
     return(0);
 }
Ejemplo n.º 2
0
        public static DataTable MakeNewStore(int year, int month)
        {
            List <Store_month> StoreList = new List <Store_month>();
            List <Paper_Store> PaperList = Paper_Store.GetAllPaperList();

            List <Paper_In>  InList  = Paper_In.GetYearMonthList(year, month);
            List <Paper_Out> OutList = Paper_Out.GetYearMonthList(year, month);

            List <Store_month> Lastlist;

            Store_month total = new Store_month();

            if (month == 1)
            {
                Lastlist = GetMonthStoreList(year - 1, 12);
            }
            else
            {
                Lastlist = GetMonthStoreList(year, month - 1);
            }
            for (int i = 0; i < PaperList.Count; i++)
            {
                Store_month st = new Store_month();
                st.PaperId   = PaperList[i].PaperId;
                st.PaperName = PaperList[i].PaperName;
                int index = -1;
                if (InList != null)
                {
                    for (int j = 0; j < InList.Count; j++)
                    {
                        if (InList[j].PaperId == PaperList[i].PaperId)
                        {
                            index       = j;
                            st.InNum   += InList[index].Num;
                            st.InMoney += InList[index].Money;
                        }
                    }
                }
                if (OutList != null)
                {
                    for (int j = 0; j < OutList.Count; j++)
                    {
                        if (OutList[j].PaperId == PaperList[i].PaperId)
                        {
                            index        = j;
                            st.OutNum   += OutList[index].Num;
                            st.OutMoney += OutList[index].Money;
                        }
                    }
                }
                if (Lastlist != null)
                {
                    for (int j = 0; j < Lastlist.Count; j++)
                    {
                        if (Lastlist[j].PaperId == PaperList[i].PaperId)
                        {
                            index        = j;
                            st.LastNum   = Lastlist[index].CurrentNum;
                            st.LastMoney = Lastlist[index].CurrentMoney;
                        }
                    }
                }
                st.Year         = year;
                st.Month        = month;
                st.OrderNo      = year * 100 + month;
                st.CalTime      = DateTime.Now;
                st.CurrentNum   = PaperList[i].Num;
                st.CurrentPrice = PaperList[i].TaxiPrice;
                st.CurrentMoney = PaperList[i].TaxiMoney;
                StoreList.Add(st);
                total.LastNum      += st.LastNum;
                total.LastMoney    += st.LastMoney;
                total.InNum        += st.InNum;
                total.InMoney      += st.InMoney;
                total.OutNum       += st.OutNum;
                total.OutMoney     += st.OutMoney;
                total.CurrentNum   += st.CurrentNum;
                total.CurrentMoney += st.CurrentMoney;
            }
            total.PaperName = "汇总";
            StoreList.Add(total);
            return(DataSource.ORMHelper.ModelListToTb <Store_month>(StoreList));
        }