示例#1
0
        public List<InvoiceListDTO> getInvoiceList(int MeterTypeID, DateTime InvoiceStartDate, DateTime InvoiceFinishDate, long? CustomerID, long? CustomerGroupID)
        {
            sqlprm.Clear();
            sqlprm.Add("MeterTypeID", MeterTypeID);
            sqlprm.Add("InvoiceStartDate", InvoiceStartDate);
            sqlprm.Add("InvoiceFinishDate", InvoiceFinishDate);
            sqlprm.Add("CustomerID", CustomerID);
            sqlprm.Add("CustomerGroupID", CustomerGroupID);

            DataTable dtInvList = this.sqlOp.executeSPInstantly("OSYS..sp_GetInvoiceList", sqlprm);
            InvoiceListDTO inv;
            List<InvoiceListDTO> invoiceList = new List<InvoiceListDTO>();

            /*
               Invoices.ID
              ,Customer.Name
              ,CustomerGroup.Name as GroupName
              ,MeterTypes.Name MeterTypeName
              ,Invoices.InvoiceDate
              ,Meters.SerialNo
              ,ReportDate
              ,KDV
              ,TotalCost
              ,KDVTotalCost
             */

            foreach (DataRow row in dtInvList.Rows)
            {
                inv = new InvoiceListDTO();
                inv.Id = Convert.ToInt64(row["ID"]);
                inv.CustomerID = Convert.ToInt32(row["CustomerID"]);
                inv.Name = row["Name"] == null ? null : row["Name"].ToString();
                inv.GroupName = row["GroupName"] == null ? null : row["GroupName"].ToString();
                inv.InvoiceDate = Convert.ToDateTime(row["InvoiceDate"]);
                inv.SerialNo = row["SerialNo"] == null ? null : row["SerialNo"].ToString();
                inv.MeterTypeName = row["MeterTypeName"] == null ? null : row["MeterTypeName"].ToString();
                inv.KDV = Convert.ToDecimal(row["Kdv"]);
                inv.KDVTotalCost = Convert.ToDecimal(row["KdvTotalCost"]);
                inv.TotalCost = Convert.ToDecimal(row["TotalCost"]);

                invoiceList.Add(inv);

            }
            dtInvList.Clear();
            return invoiceList;
        }
示例#2
0
        public List<InvoiceListDTO> getInvoiceByCustomerID(long customerID, bool isPaid)
        {
            sqlprm = new Dictionary<string, object>();
            sqlprm.Add("customerID", customerID);
            sqlprm.Add("isPaid", isPaid);

            DataTable dtInvList = this.sqlOp.executeSPInstantly("OSYS..sp_GetInvoiceByCustomerID", sqlprm);
            InvoiceListDTO inv;
            List<InvoiceListDTO> invoiceList = new List<InvoiceListDTO>();

            foreach (DataRow row in dtInvList.Rows)
            {

                inv = new InvoiceListDTO();
                inv.CustomerID = Convert.ToInt32(row["CustomerID"]);
                inv.InvoiceDate = Convert.ToDateTime(row["InvoiceDate"]);
                inv.FinalPaymentDate = Convert.ToDateTime(row["FinalPaymentDate"]);
                inv.PaymentDate = Convert.ToDateTime(row["PaymentDate"]);
                inv.IsPaid = Convert.ToBoolean(row["IsPaid"]);
                inv.MeterNo = row["MeterNo"] == null ? null : row["MeterNo"].ToString();
                inv.MeterTypeName = row["MeterTypeName"] == null ? null : row["MeterTypeName"].ToString();
                inv.KDV = Convert.ToDecimal(row["KDV"]);
                inv.KDVTotalCost = Convert.ToDecimal(row["KDVTotalCost"]);
                inv.TotalCost = Convert.ToDecimal(row["TotalCost"]);
                invoiceList.Add(inv);

            }
            dtInvList.Clear();
            return invoiceList;
        }