Example #1
0
        private void SaveJournal(object sender, EventArgs e)
        {
            if (ValidateJournalHeader())
            {
                simpanToolStripButton.Enabled = false;

                TJournal jur;

                //save journal detail
                for (int i = 0; i < tJournalDataGridView.RowCount; i++)
                {
                    jur               = new TJournal();
                    jur.JournalDate   = journalDateDateTimePicker.Value;
                    jur.JournalDesc   = tJournalDataGridView.Rows[i].Cells[4].Value.ToString();
                    jur.JournalJumlah = Convert.ToDecimal(tJournalDataGridView.Rows[i].Cells[2].Value);
                    jur.JournalPic    = string.Empty;
                    jur.JournalStatus = tJournalDataGridView.Rows[i].Cells[3].Value.ToString();
                    jur.SubAccountId  = tJournalDataGridView.Rows[i].Cells[0].Value.ToString();
                    jur.VoucherNo     = voucherNoTextBox.Text;
                    jur.ModifiedBy    = lbl_UserName.Text;
                    jur.ModifiedDate  = DateTime.Now;
                    AppCode.SaveTJournal(jur);
                }

                MessageBox.Show(this.Text + " berhasil disimpan", AppCode.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #2
0
        void ResetHeaderJournal(object sender, EventArgs e)
        {
            simpanToolStripButton.Enabled    = true;
            journalDateDateTimePicker.Value  = DateTime.Today;
            voucherNoTextBox.Text            = AppCode.GetVoucherNo();
            balanceJumlahNumericUpDown.Value = decimal.Zero;

            tJournalDataGridView.Rows.Clear();
            ResetJournalDetail(sender, e);
        }
 private void ResetPiHutangHeader(object sender, EventArgs e)
 {
     simpanToolStripButton.Enabled      = true;
     voucherNoTextBox.Text              = AppCode.GetVoucherNo();
     journalDateDateTimePicker.Value    = DateTime.Today;
     piHutangPicComboBox.SelectedIndex  = -1;
     subAccountIdComboBox.SelectedIndex = -1;
     journalDescTextBox.ResetText();
     journalJumlahNumericUpDown.Value = 0;
     tPiHutangDataGridView.Rows.Clear();
 }
Example #4
0
        void ResetHeaderJournal(object sender, EventArgs e)
        {
            simpanToolStripButton.Enabled      = true;
            kasAccountIdComboBox.SelectedIndex = -1;
            journalDateDateTimePicker.Value    = DateTime.Today;
            voucherNoTextBox.Text = AppCode.GetVoucherNo();
            kasDescTextBox.ResetText();
            kasJumlahNumericUpDown.Value = decimal.Zero;

            tJournalDataGridView.Rows.Clear();
            ResetJournalDetail(sender, e);
        }
Example #5
0
        void ResetTransaction(object sender, EventArgs e)
        {
            transactionIdLabel.Text             = DateTime.Now.ToFileTime().ToString();
            transactionDateDateTimePicker.Value = DateTime.Now;
            transactionFacturTextBox.Text       = AppCode.GenerateFacturNo(trans, string.Empty);
            transactionReferenceIdTextBox.ResetText();
            transactionByTextBox.ResetText();
            transactionByTextBox_Name.ResetText();
            transactionByNameComboBox.SelectedIndex = -1;
            transactionDescTextBox.ResetText();
            transactionDeskComboBox.SelectedIndex = -1;

            groupBox_Payment.Visible = false;

            tTransactionDetailDataGridView.Rows.Clear();
            ResetTransactionDetail();
        }
Example #6
0
        void SetInitialCommonSettings()
        {
            //kas dropdownlist
            mSubAccountBindingSource.DataSource = DataMaster.GetListEq(typeof(MSubAccount), MSubAccount.ColumnNames.AccountId, AppCode.GetKasAccountNo());

            //numeric up down
            ModuleControlSettings.SetNumericUpDown(kasJumlahNumericUpDown, true);
            ModuleControlSettings.SetNumericUpDown(journalJumlahNumericUpDown);

            //add column to grid
            for (int i = 0; i < 4; i++)
            {
                tJournalDataGridView.Columns.Add(i.ToString(), i.ToString());
            }

            //set width for grid view
            tJournalDataGridView.Columns[0].Width = label_AccId.Width;
            tJournalDataGridView.Columns[1].Width = label_AccName.Width;
            tJournalDataGridView.Columns[2].Width = label_JournalJumlah.Width;
            tJournalDataGridView.Columns[3].Width = label_JournalDesc.Width;

            //set format
            tJournalDataGridView.Columns[2].DefaultCellStyle.Format    = "N";
            tJournalDataGridView.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;

            //journal date
            ModuleControlSettings.SetDateTimePicker(journalDateDateTimePicker, false);

            //search sub acc
            PictureBox searchPic = new PictureBox();

            ModuleControlSettings.SetSearchPictureBox(subAccountIdTextBox, ListOfSearchWindow.SearchSubAccount.ToString(), searchPic);
            searchPic.Click += new EventHandler(searchPicSubAcc_Click);
            subAccountIdTextBox.Controls.Add(searchPic);

            //set display
            if (JournalStatus == ListOfJournalStatus.Debet)
            {
                SetInitialDebetSettings();
            }
            else if (JournalStatus == ListOfJournalStatus.Kredit)
            {
                SetInitialKreditSettings();
            }
        }
        void SetInitialCommonSettings()
        {
            if (IsDelete)
            {
                if (PiHutang == ListOfPiHutangStatus.Piutang)
                {
                    //beban penghapusan piutang dropdownlist
                    mSubAccountBindingSource.DataSource = DataMaster.GetListEq(typeof(MSubAccount), MSubAccount.ColumnNames.SubAccountId, AppCode.GetPiutangBebanAccountNo());
                }
                else if (PiHutang == ListOfPiHutangStatus.Hutang)
                {
                    //pendapatan penghapusan hutang dropdownlist
                    mSubAccountBindingSource.DataSource = DataMaster.GetListEq(typeof(MSubAccount), MSubAccount.ColumnNames.AccountId, AppCode.GetOtherRevenueAccountNo());
                }
            }
            else
            {
                //kas dropdownlist
                mSubAccountBindingSource.DataSource = DataMaster.GetListEq(typeof(MSubAccount), MSubAccount.ColumnNames.AccountId, AppCode.GetKasAccountNo());
            }


            //journal date
            ModuleControlSettings.SetDateTimePicker(journalDateDateTimePicker, false);

            //numeric up down
            ModuleControlSettings.SetNumericUpDown(journalJumlahNumericUpDown, true);

            //add column to grid
            tPiHutangDataGridView.ReadOnly = false;

            DataGridViewCheckBoxColumn cekColoumn = new DataGridViewCheckBoxColumn(false);

            cekColoumn.ReadOnly = false;
            tPiHutangDataGridView.Columns.Add(cekColoumn);

            for (int i = 1; i < 9; i++)
            {
                tPiHutangDataGridView.Columns.Add(i.ToString(), i.ToString());
                tPiHutangDataGridView.Columns[i].ReadOnly = true;
            }

            //set width for grid view
            tPiHutangDataGridView.Columns[0].Width = label_Pay.Width;
            tPiHutangDataGridView.Columns[1].Width = label_FacturNo.Width;
            tPiHutangDataGridView.Columns[2].Width = label_DueDate.Width;
            tPiHutangDataGridView.Columns[3].Width = label_Jumlah.Width;
            tPiHutangDataGridView.Columns[4].Width = label_Retur.Width;
            tPiHutangDataGridView.Columns[5].Width = label_Sisa.Width;
            tPiHutangDataGridView.Columns[6].Width = label_Ammount.Width;
            tPiHutangDataGridView.Columns[7].Width = label_Ammount.Width;
            tPiHutangDataGridView.Columns[8].Width = label_Ammount.Width;

            tPiHutangDataGridView.Columns[2].DefaultCellStyle.Format = ModuleControlSettings.DateFormat();

            //set format
            for (int i = 3; i < 7; i++)
            {
                tPiHutangDataGridView.Columns[i].DefaultCellStyle.Format    = "N";
                tPiHutangDataGridView.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            }
            tPiHutangDataGridView.Columns[6].ReadOnly = false;
            tPiHutangDataGridView.Columns[7].Visible  = false;
            tPiHutangDataGridView.Columns[8].Visible  = false;


            //journal date
            ModuleControlSettings.SetDateTimePicker(journalDateDateTimePicker, false);

            //set display
            if (PiHutang == ListOfPiHutangStatus.Hutang)
            {
                SetInitialHutangSettings();
            }
            else if (PiHutang == ListOfPiHutangStatus.Piutang)
            {
                SetInitialPiutangSettings();
            }
        }
        private void UpdatePiHutang(object sender, EventArgs e)
        {
            if (!ValidatePiHutang())
            {
                return;
            }

            simpanToolStripButton.Enabled = false;

            TJournal jur = new TJournal();

            jur.JournalDate   = journalDateDateTimePicker.Value;
            jur.JournalDesc   = journalDescTextBox.Text;
            jur.JournalJumlah = journalJumlahNumericUpDown.Value;
            jur.JournalPic    = piHutangPicComboBox.SelectedValue.ToString();

            if (!IsDelete)
            {
                if (PiHutang == ListOfPiHutangStatus.Piutang)
                {
                    jur.JournalStatus = ListOfJournalStatus.Debet.ToString();
                }
                else if (PiHutang == ListOfPiHutangStatus.Hutang)
                {
                    jur.JournalStatus = ListOfJournalStatus.Kredit.ToString();
                }
            }
            else
            {
                if (PiHutang == ListOfPiHutangStatus.Piutang)
                {
                    jur.JournalStatus = ListOfJournalStatus.Kredit.ToString();
                }
                else if (PiHutang == ListOfPiHutangStatus.Hutang)
                {
                    jur.JournalStatus = ListOfJournalStatus.Debet.ToString();
                }
            }


            //if (IsDelete)
            //{
            //    jur.SubAccountId = subAccountIdComboBox.SelectedValue.ToString();
            //}
            //else
            //{
            jur.SubAccountId = subAccountIdComboBox.SelectedValue.ToString();
            //}

            jur.VoucherNo    = voucherNoTextBox.Text;
            jur.ModifiedBy   = lbl_UserName.Text;
            jur.ModifiedDate = DateTime.Now;
            AppCode.SaveTJournal(jur);


            TPiHutang piHut;

            for (int i = 0; i < tPiHutangDataGridView.RowCount; i++)
            {
                if (Convert.ToBoolean(tPiHutangDataGridView.Rows[i].Cells[0].Value) == true)
                {
                    piHut = (TPiHutang)DataMaster.GetObjectByProperty(typeof(TPiHutang), TPiHutang.ColumnNames.PiHutangId, Convert.ToDecimal(tPiHutangDataGridView.Rows[i].Cells[7].Value));
                    piHut.PiHutangDibayar += Convert.ToDecimal(tPiHutangDataGridView.Rows[i].Cells[6].Value);
                    piHut.PiHutangSisa     = piHut.PiHutangJumlah - piHut.PiHutangRetur - piHut.PiHutangDibayar;

                    if (piHut.PiHutangSisa == decimal.Zero)
                    {
                        piHut.PiHutangLunasDate = journalDateDateTimePicker.Value;
                        if (piHutang == ListOfPiHutangStatus.Piutang && !IsDelete)
                        {
                            ShareCommissionInterface(piHut.TransactionId);
                        }
                    }

                    piHut.ModifiedBy   = lbl_UserName.Text;
                    piHut.ModifiedDate = DateTime.Now;
                    DataMaster.UpdatePersistence(piHut);

                    jur               = new TJournal();
                    jur.JournalDate   = journalDateDateTimePicker.Value;
                    jur.JournalDesc   = journalDescTextBox.Text;
                    jur.JournalJumlah = Convert.ToDecimal(tPiHutangDataGridView.Rows[i].Cells[6].Value);
                    jur.JournalPic    = piHutangPicComboBox.SelectedValue.ToString();

                    if (!IsDelete)
                    {
                        if (PiHutang == ListOfPiHutangStatus.Piutang)
                        {
                            jur.JournalStatus = ListOfJournalStatus.Kredit.ToString();
                        }
                        else if (PiHutang == ListOfPiHutangStatus.Hutang)
                        {
                            jur.JournalStatus = ListOfJournalStatus.Debet.ToString();
                        }
                    }
                    else
                    {
                        if (PiHutang == ListOfPiHutangStatus.Piutang)
                        {
                            jur.JournalStatus = ListOfJournalStatus.Debet.ToString();
                        }
                        else if (PiHutang == ListOfPiHutangStatus.Hutang)
                        {
                            jur.JournalStatus = ListOfJournalStatus.Kredit.ToString();
                        }
                    }


                    jur.SubAccountId = tPiHutangDataGridView.Rows[i].Cells[8].Value.ToString();
                    jur.VoucherNo    = voucherNoTextBox.Text;
                    jur.ModifiedBy   = lbl_UserName.Text;
                    jur.ModifiedDate = DateTime.Now;
                    AppCode.SaveTJournal(jur);
                }
            }

            MessageBox.Show(this.Text + " berhasil disimpan", AppCode.AssemblyProduct, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Example #9
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);
            }
        }