Пример #1
0
        private void populateDetails(Guid SaleID)
        {
            gridSummary.DataSource = SaleItem.getItemSummary(SaleID);
            gridSummary.Sort(col_gridsummary_code, ListSortDirection.Ascending);

            gridDetail.DataSource = SaleItem.getItems(SaleID);
            gridDetail.Sort(gridDetail.Columns[col_gridDetail_barcode.Name], ListSortDirection.Ascending);
        }
Пример #2
0
        private void populatePage()
        {
            if (_sale.ReturnedToSupplier)
            {
                this.Text = lblTitle.Text = "RETUR VENDOR";
            }
            else
            {
                this.Text = "INVOICE";
            }

            lblInvoiceNo.Text = "";
            lblDate.Text      = String.Format("Date: {0:dd/MM/yy hh:mm}", _sale.time_stamp);

            //customer info
            lblCustomerInfo.Text = _sale.customer_info;

            //sale summary
            grid.AutoGenerateColumns = false;
            if (_isGenerate)
            {
                _data = _saleItems;
                _data = Sale.compileSummaryData(_data);
            }
            else
            {
                _data = SaleItem.getItemSummary(_sale.id);
            }

            //sort
            DataView dvw = _data.DefaultView;

            dvw.Sort = InventoryItem.COL_DB_INVENTORY_CODE + " ASC";
            _data    = dvw.ToTable();

            //grid.DataSource = _data;
            _totalPageCount = (int)Math.Ceiling((decimal)_data.Rows.Count / MAX_ITEMS_PER_PAGE);
            populateGrids();

            _totalSale = Convert.ToDecimal(_data.Compute(String.Format("SUM({0})", InventoryItem.COL_SALE_SUBTOTAL), ""));

            lblShippingCost.Text = string.Format("Angkutan {0}: {1:N0}", _sale.TransportName, _sale.ShippingCost);

            Inventory.setAmount(lblTotalSale, _totalSale.ToString());
            Inventory.setAmount(lblGrandTotal, (_totalSale + _sale.ShippingCost).ToString());
            Inventory.setCount(lblTotalCounts,
                               _data.Compute(String.Format("SUM({0})", InventoryItem.COL_SALE_QTY), "").ToString(),
                               _data.Compute(String.Format("SUM({0})", InventoryItem.COL_DB_LENGTH), "").ToString());

            txtNotes.Text = Tools.applyNewLines(_sale.notes);

            if (_isGenerate)
            {
                decimal totalDue = _totalSale + _sale.ShippingCost;
                txtPaymentAmount.Text = totalDue.ToString("N0");
                rbCash1.Text          = ((Math.Ceiling(totalDue / 10000) * 10000) - 5000).ToString("N0");
                if (LIBUtil.Util.zeroNonNumericString(rbCash1.Text) < LIBUtil.Util.zeroNonNumericString(txtPaymentAmount.Text))
                {
                    rbCash1.Text = txtPaymentAmount.Text;
                }
                rbCash2.Text = (Math.Ceiling(totalDue / 10000) * 10000).ToString("N0");
                rbCash3.Text = ((Math.Ceiling(totalDue / 100000) * 100000) - 50000).ToString("N0");
                if (LIBUtil.Util.zeroNonNumericString(rbCash3.Text) < LIBUtil.Util.zeroNonNumericString(txtPaymentAmount.Text))
                {
                    rbCash3.Text = rbCash2.Text;
                    rbCash2.Text = rbCash1.Text;
                    rbCash1.Text = txtPaymentAmount.Text;
                }
                rbCash4.Text = (Math.Ceiling(totalDue / 100000) * 100000).ToString("N0");
            }
        }