示例#1
0
        public SalesOrder GetSalesOrderByYear(SalesOrder sOrder, int year)
        {
            soBl = new SalesOrderBLL();

            sOrder = soBl.GetSalesOrderByYear(sOrder, year);

            if (sOrder.totalVentas != null)
            {
                if (sOrder.totalVentas.Count > 0)
                {
                    MaximoVentas = sOrder.totalVentas.Max();
                    MinimoVentas = sOrder.totalVentas.Min();
                }

                if (sOrder.meses.Count > 0)
                {
                    MaximoMes = sOrder.meses[sOrder.totalVentas.IndexOf(sOrder.MaximoVentas)];
                    MinimoMes = sOrder.meses[sOrder.totalVentas.IndexOf(sOrder.MinimoVentas)];
                }
            }

            return(sOrder);
        }
示例#2
0
        private void Savesales_Click(object sender, RoutedEventArgs e)
        {
            if (srcustomer.Name == "" || txtemail.Name == "" || dtSales.Text == "" || cbCurrency.Text == "" || srnodokumen.Name == "" || txtsalesorderno.Text == "" || cbLocation.Text == "" || dtValidaty.Text == "" || cbAnnual.Text == "" || srstaff.Name == "" || txtAnnualFrequency.Text == "" || dtAnnual.Text == "")
            {
                MessageBox.Show("please fill in the blank fields", ("Form Validation"), MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            SalesOrderBLL orderBLL   = new SalesOrderBLL();
            SalesOrder    salesorder = new SalesOrder();

            if (this.kontakSelected != null)
            {
                salesorder.IdPelanggan   = this.kontakSelected.Id;
                salesorder.NamaPelanggan = this.kontakSelected.NamaA;
            }
            salesorder.Email = txtemail.Text;
            salesorder.NoHp  = txthp.Text;
            salesorder.TanggalOrderPenjualan = DateTime.Parse(dtSales.Text);
            if (this.DataMataUangSelected != null)
            {
                salesorder.IdMataUang = this.DataMataUangSelected.Id;
                salesorder.MataUang   = this.DataMataUangSelected.NamaMataUang;
                salesorder.KursTukar  = this.DataMataUangSelected.KursTukar;
            }
            if (this.dokumenSelected != null)
            {
                salesorder.IdNoReferensiDokumen = this.dokumenSelected.Id;
                salesorder.NoReferensiDokumen   = this.dokumenSelected.NoReferensiDokumen;
            }
            salesorder.NoOrderPenjualan = txtsalesorderno.Text;
            if (this.salesquotationSelected != null)
            {
                salesorder.IdPenawaran = this.salesquotationSelected.Id;
                salesorder.NoPenawaran = this.salesquotationSelected.NoPenawaranHarga;
            }
            salesorder.Keterangan = txtNote.Text;
            if (this.lokasiSelected != null)
            {
                salesorder.IdLokasi   = this.lokasiSelected.Id;
                salesorder.NamaLokasi = this.lokasiSelected.NamaTempatLokasi;
            }
            if (this.dataDepartemenSelected != null)
            {
                salesorder.IdDepartemen = this.dataDepartemenSelected.Id;
            }
            if (this.dataProyekSelected != null)
            {
                salesorder.IdProyek = this.dataProyekSelected.Id;
            }
            salesorder.CheckboxInclusiveTax = chkinclusive.IsChecked;
            salesorder.CheckboxSelesai      = chkcomplete.IsChecked;
            salesorder.TanggalPengantaran   = DateTime.Parse(dtValidaty.Text);
            if (this.petugasSelected != null)
            {
                salesorder.IdPetugas   = this.petugasSelected.Id;
                salesorder.NamaPetugas = this.petugasSelected.NamaA;
            }
            if (this.termspembayaranSelected != null)
            {
                salesorder.IdTermPembayaran = this.termspembayaranSelected.IdTermPembayaran;
                salesorder.TermPembayaran   = this.termspembayaranSelected.NamaSkema;
            }
            salesorder.CheckboxBerulang = chkannual.IsChecked;
            salesorder.DurasiBerulang   = double.Parse(txtAnnualFrequency.Text);
            salesorder.TanggalBerulang  = DateTime.Parse(dtAnnual.Text);
            if (this.optionAnnualSelected != null)
            {
                salesorder.IdOpsiAnnual = this.optionAnnualSelected.IdOptionAnnual;
                salesorder.Annual       = this.optionAnnualSelected.Annual;
            }
            if (this.salesquotationSelected != null)
            {
                salesorder.IdTransaksi = this.salesquotationSelected.Id;
            }
            salesorder.IdKodeTransaksi    = 18;
            salesorder.KodeTransaksi      = "SO";
            salesorder.IdPeriodeAkuntansi = 1;
            salesorder.RealRecordingTime  = DateTime.Now;
            salesorder.TotalOrderProduk   = salesorder.TotalSebelumPajak;
            salesorder.TotalSebelumPajak  = double.Parse(txttotalbeforetax.Text);
            salesorder.TotalPajak         = double.Parse(txtTotalTax.Text);
            salesorder.TotalSetelahPajak  = double.Parse(txtAfterTotalTax.Text);
            if (orderBLL.AddSalesOrder(salesorder) > 0)
            {
                //  this.ClearForm();
                MessageBox.Show("Sales Order successfully added !");
            }
            else
            {
                MessageBox.Show("Sales Order failed to add !");
            }
            Sales v = new Sales();

            Switcher.Switchorder(v);
        }