Exemple #1
0
        void financeIdComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            IList list = new List <TTransaction>();

            if (financeIdComboBox.SelectedIndex != 0)
            {
                NHibernate.Expression.ICriterion[] expArrays = new NHibernate.Expression.ICriterion[3];
                expArrays[0] = NHibernate.Expression.Expression.Eq(TTransaction.ColumnNames.TransactionDesc2, financeIdComboBox.SelectedValue.ToString());

                expArrays[1] = NHibernate.Expression.Expression.Eq(TTransaction.ColumnNames.TransactionStatus, ListOfTransaction.Sales.ToString());

                //sisa utang tidak nol
                expArrays[2] = NHibernate.Expression.Expression.Not(NHibernate.Expression.Expression.Eq(TTransaction.ColumnNames.TransactionPpn, decimal.Zero));

                NHibernate.Expression.Order[] orderArrays = new NHibernate.Expression.Order[1];
                orderArrays[0] = NHibernate.Expression.Order.Asc(TTransaction.ColumnNames.TransactionDate);

                list = DataMaster.GetList(typeof(TTransaction), expArrays, orderArrays);
                for (int i = 0; i < list.Count; i++)
                {
                    TTransaction t = list[i] as TTransaction;
                    t.TransactionByName = AppCode.GetCustomerName(t.TransactionBy, true);
                }
            }
            tTransactionBindingSource.DataSource = list;
        }
Exemple #2
0
        public void BindData(object sender, EventArgs e)
        {
            string myKeyWord = "%" + txt_SearchById.Text.Trim() + "%";

            if (txt_SearchById.Text.Equals("<Cari Berdasar No Faktur>"))
            {
                myKeyWord = "%%";
            }

            bindingSource_Search.Clear();
            IList listSearch = null;

            if (trans_Type == ListOfTransaction.Sales)
            {
                listSearch = new List <TTransaction>();

                IList        listTemp = DataMaster.GetListBetweenEqLikeValue(typeof(TTransaction), TTransaction.ColumnNames.TransactionDate, dt_From.Value, dt_To.Value, TTransaction.ColumnNames.TransactionStatus, ListOfTransaction.Sales.ToString(), TTransaction.ColumnNames.TransactionFactur, myKeyWord);
                TTransaction trans;
                for (int i = 0; i < listTemp.Count; i++)
                {
                    trans = (TTransaction)listTemp[i];
                    listSearch.Add(trans);
                }

                listTemp = DataMaster.GetListBetweenEqLikeValue(typeof(TTransaction), TTransaction.ColumnNames.TransactionDate, dt_From.Value, dt_To.Value, TTransaction.ColumnNames.TransactionStatus, ListOfTransaction.SalesVIP.ToString(), TTransaction.ColumnNames.TransactionFactur, myKeyWord);
                for (int i = 0; i < listTemp.Count; i++)
                {
                    trans = (TTransaction)listTemp[i];
                    listSearch.Add(trans);
                }
            }
            else
            {
                listSearch = DataMaster.GetListBetweenEqLikeValue(typeof(TTransaction), TTransaction.ColumnNames.TransactionDate, dt_From.Value, dt_To.Value, TTransaction.ColumnNames.TransactionStatus, trans_Type.ToString(), TTransaction.ColumnNames.TransactionFactur, myKeyWord);
            }

            if (trans_Type == ListOfTransaction.SalesVIP || trans_Type == ListOfTransaction.Sales || trans_Type == ListOfTransaction.ReturSales || trans_Type == ListOfTransaction.ReturSalesVIP)
            {
                for (int i = 0; i < listSearch.Count; i++)
                {
                    TTransaction t = listSearch[i] as TTransaction;
                    t.TransactionByName = AppCode.GetCustomerName(t.TransactionBy, true);
                }
            }
            else
            {
                for (int i = 0; i < listSearch.Count; i++)
                {
                    TTransaction t = listSearch[i] as TTransaction;
                    t.TransactionByName = AppCode.GetSupplierName(t.TransactionBy);
                }
            }

            if (listSearch.Count > 0)
            {
                bindingSource_Search.DataSource = listSearch;
            }
        }
Exemple #3
0
 void FormPayment_Load(object sender, EventArgs e)
 {
     //finance
     AppCode.FillFinanceComboBox(financeIdComboBox);
     Module.ModuleControlSettings.SetDateTimePicker(paymentDateDateTimePicker, false);
     paymentDateDateTimePicker.Value = DateTime.Today;
     Module.ModuleControlSettings.SetNumericUpDown(paymentAmmountNumericUpDown, false, 0);
     Module.ModuleControlSettings.SetGridDataView(tTransactionDataGridView);
 }
Exemple #4
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            //fill color
            AppCode.FillColorComboBox(stockDesc1ComboBox);
            //fill unit
            AppCode.FillItemComboBox(itemIdComboBox);


            grid_Master.DataSource = bindingSource_Master;
            bindingSource_Master.Clear();
            BindData();
        }
        private void FillFilter()
        {
            //date
            transactionDateDateTimePicker.Value = DateTime.Today.AddDays(-30);
            Module.ModuleControlSettings.SetDateTimePicker(transactionDateDateTimePicker, false);
            transactionDateToDateTimePicker.Value = DateTime.Today;
            Module.ModuleControlSettings.SetDateTimePicker(transactionDateToDateTimePicker, false);

            //lokasi
            AppCode.FillGudangComboBox(gudangIdComboBox);
            //channel
            AppCode.FillChannelComboBox(locationIdComboBox);
            //fill color
            AppCode.FillColorComboBox(stockDesc1ComboBox);
            //fill type unit
            AppCode.FillItemComboBox(itemIdComboBox);

            //status stok
            StatusStockComboBox.SelectedIndex = 0;

            //gudang
            gudangIdComboBox.SelectedIndex = 0;
            //location
            locationIdComboBox.SelectedIndex = 0;

            //set transaction by
            switch (listOfTransaction)
            {
            case ListOfTransaction.Correction:
                //pelanggan
                AppCode.FillCustomerComboBox(transactionByComboBox);
                break;

            case ListOfTransaction.Mutation:
                //pelanggan
                AppCode.FillCustomerComboBox(transactionByComboBox);
                break;

            case ListOfTransaction.Purchase:
                //supplier
                AppCode.FillSupplierComboBox(transactionByComboBox);
                break;

            case ListOfTransaction.PurchaseOrder:
                break;

            case ListOfTransaction.ReturPurchase:
                break;

            case ListOfTransaction.ReturSales:
                break;

            case ListOfTransaction.ReturSalesVIP:
                break;

            case ListOfTransaction.Sales:
                //pelanggan
                AppCode.FillCustomerComboBox(transactionByComboBox);
                break;

            case ListOfTransaction.SalesVIP:
                break;

            case ListOfTransaction.Service:
                break;

            case ListOfTransaction.Temp:
                break;

            case ListOfTransaction.Usage:
                break;

            default:
                break;
            }
        }
Exemple #6
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            AppCode.FillItemComboBox(itemIdComboBox);
        }
Exemple #7
0
        private void CalculateItemValue()
        {
            //IList listGudang = DataMaster.GetAll(typeof(MGudang));
            //MGudang gud;

            //IList listItemStok;
            //ItemGudangStok stok;
            //MItem item;

            //decimal itemvalue = 0;

            //for (int i = 0; i < listGudang.Count; i++)
            //{
            //    gud = (MGudang)listGudang[i];
            //    listItemStok = DataMaster.GetListEq(typeof(ItemGudangStok), ItemGudangStok.ColumnNames.GudangId, gud.GudangId);
            //    for (int j = 0; j < listItemStok.Count; j++)
            //    {
            //        stok = (ItemGudangStok)listItemStok[j];
            //        item = (MItem)DataMaster.GetObjectByProperty(typeof(MItem), MItem.ColumnNames.ItemId, stok.ItemId);
            //        if (item != null)
            //        {
            //            itemvalue += stok.ItemStok * item.ItemPricePurchaseAvg;
            //        }
            //    }
            //}

            //IList listTrans = DataMaster.GetListBetweenValue(typeof(TTransaction), TTransaction.ColumnNames.TransactionDate, from, to);
            //IList listDet;
            //TTransaction trans;
            //TTransactionDetail det;

            //decimal salesTot = 0;
            //decimal retSalesTot = 0;
            //decimal hppSalesTot = 0;
            //decimal hppRetSalesTot = 0;
            ////decimal purTot = 0;
            ////decimal retPurTot = 0;

            //for (int i = 0; i < listTrans.Count; i++)
            //{
            //    trans = (TTransaction)listTrans[i];

            //    if (trans.TransactionStatus == ListOfTransaction.Sales.ToString() || trans.TransactionStatus == ListOfTransaction.ReturSales.ToString())
            //    {
            //        listDet = DataMaster.GetListEq(typeof(TTransactionDetail), TTransactionDetail.ColumnNames.TransactionId, trans.TransactionId);
            //        for (int j = 0; j < listDet.Count; j++)
            //        {
            //            det = (TTransactionDetail)listDet[j];
            //            if (trans.TransactionStatus == ListOfTransaction.Sales.ToString())
            //                hppSalesTot += det.CostPrice;
            //            else if (trans.TransactionStatus == ListOfTransaction.ReturSales.ToString())
            //                hppRetSalesTot += det.CostPrice;
            //        }

            //    }
            //}

            //decimal hppNet = hppSalesTot - hppRetSalesTot;

            //string voucherno = AppCode.GetVoucherNo();

            //TJournal jur = new TJournal();
            //jur.JournalDate = DateTime.Today;
            //jur.JournalDesc = "Harga Pokok Penjualan bulan " + comboBox_Month.Text + " " + numericUpDown_Year.Value.ToString();
            //jur.JournalJumlah = hppNet;
            //jur.JournalPic = string.Empty;
            //jur.JournalStatus = ListOfJournalStatus.Debet.ToString();
            //jur.SubAccountId = AppCode.GetHPPAccountNo();
            //jur.VoucherNo = voucherno;
            //jur.ModifiedBy = lbl_UserName.Text;
            //jur.ModifiedDate = DateTime.Now;
            //AppCode.SaveTJournal(jur);

            //jur = new TJournal();
            //jur.JournalDate = DateTime.Today;
            //jur.JournalDesc = "Ikhtiar Rugi Laba bulan " + comboBox_Month.Text + " " + numericUpDown_Year.Value.ToString();
            //jur.JournalJumlah = hppNet;
            //jur.JournalPic = string.Empty;
            //jur.JournalStatus = ListOfJournalStatus.Kredit.ToString();
            //jur.SubAccountId = AppCode.GetIkhtiarRLAccountNo();
            //jur.VoucherNo = voucherno;
            //jur.ModifiedBy = lbl_UserName.Text;
            //jur.ModifiedDate = DateTime.Now;
            //AppCode.SaveTJournal(jur);

            IList       listSubAcc = DataMaster.GetAll(typeof(MSubAccount));
            MSubAccount sub;
            MAccount    acc;
            decimal     rl = 0;

            for (int i = 0; i < listSubAcc.Count; i++)
            {
                sub = (MSubAccount)listSubAcc[i];
                SaveRekap(sub.AccountId, sub.SubAccountId, sub.SubAccountName, sub.SubAccountSaldo);
                acc = (MAccount)DataMaster.GetObjectByProperty(typeof(MAccount), MAccount.ColumnNames.AccountId, sub.AccountId);
                if (acc != null)
                {
                    if (acc.AccountPosition == ListOfAccountPosition.RugiLaba.ToString())
                    {
                        rl += sub.SubAccountSaldo;
                    }
                }
            }

            string voucherno = AppCode.GetVoucherNo();

            if (comboBox_Month.SelectedValue.ToString() == "12")
            {
                TJournal jur;
                IList    listAcc = DataMaster.GetListEq(typeof(MAccount), MAccount.ColumnNames.AccountPosition, ListOfAccountPosition.RugiLaba.ToString());
                for (int i = 0; i < listAcc.Count; i++)
                {
                    acc        = (MAccount)listAcc[i];
                    listSubAcc = DataMaster.GetListEq(typeof(MSubAccount), MSubAccount.ColumnNames.AccountId, acc.AccountId);
                    for (int j = 0; j < listSubAcc.Count; j++)
                    {
                        sub               = (MSubAccount)listSubAcc[j];
                        jur               = new TJournal();
                        jur.JournalDate   = DateTime.Today;
                        jur.JournalDesc   = "Jurnal Pembalik periode " + numericUpDown_Year.Value.ToString();
                        jur.JournalJumlah = sub.SubAccountSaldo;
                        jur.JournalPic    = lbl_UserName.Text;
                        jur.JournalStatus = ListOfJournalStatus.Debet.ToString();

                        jur.SubAccountId = sub.SubAccountId;
                        jur.VoucherNo    = voucherno;
                        jur.ModifiedBy   = lbl_UserName.Text;
                        jur.ModifiedDate = DateTime.Now;
                        AppCode.SaveTJournal(jur);
                    }
                }

                sub = (MSubAccount)DataMaster.GetObjectByProperty(typeof(MSubAccount), MSubAccount.ColumnNames.SubAccountId, AppCode.GetLabaDitahanAccountNo());

                jur               = new TJournal();
                jur.JournalDate   = DateTime.Today;
                jur.JournalDesc   = "Laba Tahun " + numericUpDown_Year.Value.ToString();
                jur.JournalJumlah = rl;
                jur.JournalPic    = lbl_UserName.Text;
                jur.JournalStatus = ListOfJournalStatus.Kredit.ToString();
                jur.SubAccountId  = sub.SubAccountId;
                jur.VoucherNo     = voucherno;
                jur.ModifiedBy    = lbl_UserName.Text;
                jur.ModifiedDate  = DateTime.Now;
                AppCode.SaveTJournal(jur);

                SaveRekap(sub.AccountId, sub.SubAccountId, sub.SubAccountName, rl);
            }
            else
            {
                SaveRekap("", "", "Laba/Rugi Periode Berjalan", rl);
            }
        }