예제 #1
0
        public void ShowList(itemMasterList list)
        {
            string sql = "SELECT [ITEMCODE],[ITEMNAME],[ITEMSORT],[ITEMPRICE],[ITEMSATUAN] FROM [standArtInvoicingDB].[dbo].[ITEM]";

            DataSet dataSet = DataProvider.GetDataSet(sql);

            //Create variable for dataset table
            DataTable itemTabel = dataSet.Tables[0];

            itemMaster nextItem = null;

            foreach (DataRow parentRow in itemTabel.Rows)
            {
                nextItem = new itemMaster();

                nextItem.Code   = parentRow["ITEMCODE"].ToString();
                nextItem.Name   = parentRow["ITEMNAME"].ToString();
                nextItem.Sort   = parentRow["ITEMSORT"].ToString();
                nextItem.Price  = Convert.ToDecimal(parentRow["ITEMPRICE"]);
                nextItem.Satuan = parentRow["ITEMSATUAN"].ToString();

                list.Add(nextItem);
            }
            dataSet.Dispose();
        }
예제 #2
0
        public void ListGroupHarga(GrouphargaList list)
        {
            string sql = "SELECT [GROUPCODE],[groupKET],[GROUPSTAT] FROM [standArtInvoicingDB].[dbo].[priceGroup]";

            DataSet dataSet = DataProvider.GetDataSet(sql);

            //Create variable for DataSet table
            DataTable groupPriceTabel = dataSet.Tables[0];

            GroupHargaItem nextGroup = null;

            foreach (DataRow parentRow in groupPriceTabel.Rows)
            {
                nextGroup = new GroupHargaItem();

                nextGroup.GroupCode  = parentRow["GROUPCODE"].ToString();
                nextGroup.Keterangan = parentRow["GROUPKET"].ToString();
                nextGroup.Stat       = Convert.ToBoolean(parentRow["GROUPSTAT"]);

                list.Add(nextGroup);
            }

            dataSet.Dispose();
        }
예제 #3
0
        public void LoadInvoice(InvoiceList invoiceList)
        {
            //Build query to get Invoice's and their roti
            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append(String.Format("SELECT [invoiceNo],[invoiceTgl],[slsmCode],[slsmName],[kurs],[nomorPO] ,[outletCode] ,[termsOfPayment],[nomorFakturPajak],[nomorKwitansi],[expiredDate],[subTotal],[ppn],[totalBersih] FROM [standArtInvoicingDB].[dbo].[Invoice]"));
            sqlQuery.Append(string.Format("SELECT [invoiceNo],[itemCode],[itemName],[itemPrice],[itemQty] FROM[standArtInvoicingDB].[dbo].[InvoiceDetail]"));

            //Get a data set from the query
            DataSet dataSet = DataProvider.GetDataSet(sqlQuery.ToString());

            //Create Variables for data set tables
            DataTable invoiceTable = dataSet.Tables[0];
            DataTable detailTable  = dataSet.Tables[1];

            //Create a data relation from invoice (parent table) to detail Invoice
            DataColumn   parentColumn    = invoiceTable.Columns["invoiceNo"];
            DataColumn   childColumn     = detailTable.Columns["invoiceNo"];
            DataRelation invoiceToDetail = new DataRelation("invoiceToDetail", parentColumn, childColumn, false);

            dataSet.Relations.Add(invoiceToDetail);

            //Load InvoiceList from the data set
            invoicePerItem nextInvoice = null;
            InvoiceDetail  nextRoti    = null;

            foreach (DataRow parentRow in invoiceTable.Rows)
            {
                ////Create a new invoice
                //bool createDatabaseRecord = false;
                //nextInvoice = new invoicePerItem(createDatabaseRecord);

                ////Fill in invoice properties
                //nextInvoice.InvoiceID = Convert.ToInt32(parentRow["invoiceID"]);
                //nextInvoice.Nomor = parentRow["noInvoice"].ToString();
                //nextInvoice.PeriodeBulan = Convert.ToDateTime(parentRow["periodeBulan"]);
                //nextInvoice.SlsmCode = parentRow["slsmCode"].ToString();
                //nextInvoice.SlsmName = parentRow["slsmName"].ToString();
                ////nextInvoice.SubTotal = Convert.ToDecimal(parentRow["subTotal"]);
                //nextInvoice.PPN = Convert.ToInt32(parentRow["ppn"]);
                ////nextInvoice.Total = Convert.ToDecimal(parentRow["total"]);
                //nextInvoice.IssuedData = Convert.ToDateTime(parentRow["issuedDate"]);

                ////Get Invoice Item
                //DataRow[] childRows = parentRow.GetChildRows(invoiceToDetail);

                ////Create invoiceItem object foe each of the invoice
                //foreach (DataRow childRow in childRows)
                //{
                //    //Create a new item
                //    nextRoti = new rotiItem();

                //    //Fill in roti's properties
                //    nextRoti.ID = Convert.ToInt32(childRow["rotiID"]);
                //    nextRoti.Code = childRow["itemCode"].ToString();
                //    nextRoti.Name = childRow["itemName"].ToString();
                //    nextRoti.Qty = Convert.ToInt32(childRow["itemQty"]);
                //    nextRoti.Price = Convert.ToDecimal(childRow["itemPrice"]);

                //    //Add roti to invoice
                //    nextInvoice.Items.Add(nextRoti);
                //}

                ////Add the invoice to the invoice List
                //invoiceList.Add(nextInvoice);
            }

            //Dispose of the dataset
            dataSet.Dispose();
        }