Exemplo n.º 1
0
        private void LpSupplier_Click(object sender, RoutedEventArgs e)
        {
            var context = new  Datas.Contexts.SupplierContext();

            HelperPrint.PrintPreviewWithFormAction("Print Preview",
                                                   new ReportDataSource {
                Name = "DataSet1", Value = context.Source
            },
                                                   "MainApp.Reports.Layouts.LaporanSupplier.rdlc", null);
        }
Exemplo n.º 2
0
        public TransaksiPembelianContext()
        {
            Source = new ObservableCollection <Pembelian>();
            using (var db = new OcphDbContext())
            {
                var datas = from pembelian in db.Pembelians.Select()
                            join supplier in db.Suppliers.Select() on pembelian.SupplierId equals supplier.SupplierId
                            join user in db.Users.Select() on pembelian.UserId equals user.UserId

                            select new PembelianDto
                {
                    PembelianId = pembelian.PembelianId,
                    NomorFaktur = pembelian.NomorFaktur,
                    Tanggal     = pembelian.Tanggal,
                    JatuhTempo  = pembelian.JatuhTempo,
                    Pembayaran  = pembelian.Pembayaran,
                    Pelunasan   = pembelian.Pelunasan,
                    SupplierId  = pembelian.SupplierId,
                    UserId      = pembelian.UserId,
                    Supplier    = supplier,
                    User        = user
                };


                foreach (var item in datas)
                {
                    var model   = Mapper.Map <Pembelian>(item);
                    var details = (from detail in db.DetailPembelian.Where(x => x.PembelianId == item.PembelianId)
                                   join barang in db.Barangs.Select() on detail.BarangId equals barang.BarangId
                                   select new ItemPembelian
                    {
                        KodeBarang = barang.KodeBarang,
                        DetailPembelianId = detail.DetailPembelianId,
                        PembelianId = detail.PembelianId,
                        HargaBeli = barang.HargaBeli,
                        HargaJual = barang.HargaJual,
                        Jumlah = detail.Jumlah,
                        Merk = barang.Merk,
                        Satuan = barang.Satuan,
                        NamaBarang = barang.NamaBarang,
                        BarangId = barang.BarangId
                    });
                    model.Details = new ObservableCollection <ItemPembelian>(details);

                    Source.Add(model);
                }
            }



            barangContext   = new BarangContext();
            supplierContext = new SupplierContext();
        }