示例#1
0
        private void ShowDataJenisLunas(int rowIndex)
        {
            //  get key (jenisLunasID)
            string jenisLunasID = (string)ListLunasTable.Rows[rowIndex]["JenisLunasIDCol"];

            //  get nama jenis lunas
            var jenisLunasName = "";
            var jenisLunas     = _jenisLunasBL.GetData(jenisLunasID);

            if (jenisLunas != null)
            {
                jenisLunasName = jenisLunas.JenisLunasName;
            }

            //  get key penjualan
            string penjualanID = (string)ListLunasTable.Rows[rowIndex]["PenjualanID"];
            //  get nama pembeli
            var penjualan    = _penjualanBL.GetData(penjualanID);
            var ketPenjualan = "";

            if (penjualan != null)
            {
                ketPenjualan = " (a/n " + penjualan.BuyerName + ")";
            }

            //  tampilkan di grid
            ListLunasTable.Rows[rowIndex]["KeteranganCol"] = jenisLunasName + ketPenjualan;
        }
示例#2
0
        public IEnumerable <BPStokDetilView> ListDetil(string brgID, string tgl1, string tgl2)
        {
            var stokTgl2        = GetStokAkhir(brgID, tgl2);
            var listBpStokDetil = _bpStokDetilDal.ListData(brgID, tgl1, tgl2);

            if ((stokTgl2 <= 0) && (listBpStokDetil == null))
            {
                return(null);
            }

            var    brg     = _brgDal.GetData(brgID);
            string brgName = "";

            if (brg != null)
            {
                brgName = brg.BrgName;
            }

            var result = new List <BPStokDetilView>();

            //  ambil stok awal;
            decimal stokAwal  = GetStokAwal(brgID, tgl1);
            decimal sumQtyIn  = stokAwal;
            decimal sumQtyOut = 0;
            decimal saldoQty  = stokAwal;
            int     noUrut    = 0;

            result.Add(new BPStokDetilView
            {
                BrgID         = brgID,
                BrgName       = brgName,
                BPStokID      = "STOK-AWAL",
                BPStokDetilID = "STOK-AWAL-0",
                Tgl           = tgl1,
                Jam           = "00:00:00",
                NoUrut        = noUrut,
                JenisMutasi   = "",
                QtyIn         = stokAwal,
                QtyOut        = 0,
                NilaiHpp      = 0,
                ReffID        = "STOK-AWAL",
                SaldoQty      = stokAwal,
                HargaJual     = 0
            });
            if (listBpStokDetil != null)
            {
                foreach (var item in listBpStokDetil.OrderBy(x => x.Tgl.ToTglYMD() + x.Jam))
                {
                    noUrut++;
                    sumQtyIn  += item.QtyIn;
                    sumQtyOut += item.QtyOut;
                    saldoQty  += (item.QtyIn - item.QtyOut);
                    var jenisTrs = "";
                    var item2    = new BPStokDetilView(item);
                    switch (item2.ReffID.Substring(0, 2))
                    {
                    case "JL":
                        var jual = _penjualanBL.GetData(item.ReffID);
                        if (jual != null)
                        {
                            jenisTrs = string.Format("Jual - {0}", jual.BuyerName);
                        }
                        else
                        {
                            jenisTrs = "Jual";
                        }
                        break;

                    case "AJ":
                        jenisTrs = "Adjust";
                        break;

                    default:
                        break;
                    }
                    item2.JenisMutasi = jenisTrs;
                    item2.BrgID       = "";
                    item2.BrgName     = "";
                    item2.NoUrut      = noUrut;
                    item2.SaldoQty    = saldoQty;
                    result.Add(item2);
                }
            }

            noUrut++;
            var itemSummary = new BPStokDetilView
            {
                BrgID         = "",
                BrgName       = "",
                BPStokID      = "",
                BPStokDetilID = "",
                Tgl           = "",
                Jam           = "",
                NoUrut        = noUrut,
                JenisMutasi   = "BALANCE",
                QtyIn         = sumQtyIn,
                QtyOut        = sumQtyOut,
                NilaiHpp      = 0,
                ReffID        = "",
                SaldoQty      = saldoQty,
                HargaJual     = 0
            };

            result.Add(itemSummary);

            return(result);
        }
示例#3
0
        private void ShowData()
        {
            JamTrsTimer.Enabled = false;
            var id        = NoTrsTextBox.Text;
            var penjualan = _penjualanBL.GetData(id);

            if (penjualan == null)
            {
                ClearForm();
                return;
            }

            TanggalDateTime.Value          = penjualan.TglPenjualan.ToDate();
            JamTextBox.Text                = penjualan.JamPenjualan;
            CustomerComboBox.SelectedValue = penjualan.CustomerID;
            BuyerNameTextBox.Text          = penjualan.BuyerName;
            AlamatTextBox.Text             = penjualan.Alamat;
            NoTelpTextBox.Text             = penjualan.NoTelp;
            CatatanTextBox.Text            = penjualan.Catatan;
            DepositCheckBox.Checked        = penjualan.IsBayarDeposit;
            DepositIDText.Text             = penjualan.DepositID;
            ShowDeposit();
            NilaiDepositText.Value  = penjualan.NilaiDeposit;
            BiayaKirimNumText.Value = penjualan.NilaiBiayaKirim;

            DiskonNumText.Value    = penjualan.NilaiDiskonLain;
            BiayaLainNumText.Value = penjualan.NilaiBiayaLain;

            DetilPenjualanTable.Rows.Clear();
            foreach (var item in penjualan.ListBrg)
            {
                DetilPenjualanTable.Rows.Add(
                    item.BrgID,
                    item.BrgName,
                    item.Qty,
                    item.Harga,
                    item.Diskon,
                    item.SubTotal,
                    item.BPStokID
                    );
            }

            //  tampilkan keterangan Slot Control
            for (var i = 0; i <= penjualan.ListBrg.Count() - 1; i++)
            {
                ShowDataBrgGrid(i);
            }

            AddRow();


            if (penjualan.ListBayar != null)
            {
                foreach (var item in penjualan.ListBayar.Where(x => x.NilaiBayar > 0))
                {
                    if (_listBayarDetil == null)
                    {
                        _listBayarDetil = new List <PenjualanBayarModel>();
                    }

                    _listBayarDetil.Add(new PenjualanBayarModel
                    {
                        JenisBayarID   = item.JenisBayarID,
                        JenisBayarName = item.JenisBayarName,
                        NilaiBayar     = item.NilaiBayar,
                        Catatan        = item.Catatan
                    });
                }

                if (penjualan.ListBayar.Where(x => x.JenisBayarID == "KAS").Any())
                {
                    BayarCashNumText.Value = penjualan.ListBayar
                                             .Where(x => x.JenisBayarID == "KAS")
                                             .Where(x => x.NilaiBayar > 0)
                                             .Sum(x => x.NilaiBayar);
                }
            }
            ReCalcTotal();
        }