private void FillCommissionShareTabPages(decimal CommissionId, bool isSavePosition)
        {
            if (isSavePosition && CommissionId == 0)
            {
                MCommission comm = (MCommission)DataMaster.GetObjectByProperty(typeof(MCommission), MCommission.ColumnNames.CommissionStatus, commissionStatusComboBox.SelectedItem.ToString());
                CommissionId = comm.CommissionId;
            }
            Type             share = typeof(ListOfCommissionShare);
            TabPage          tab;
            NumericUpDown    num;
            TextBox          txt;
            MCommissionShare commShare;
            string           shareName;

            foreach (string s in Enum.GetNames(share))
            {
                shareName = Enum.Parse(share, s).ToString();
                commShare = (MCommissionShare)DataMaster.GetObjectByProperty(typeof(MCommissionShare), MCommissionShare.ColumnNames.CommissionId, CommissionId, MCommissionShare.ColumnNames.ShareTo, shareName);
                if (commShare == null)
                {
                    commShare = new MCommissionShare();
                }

                tab = tabControl_CommissionShare.TabPages[ControlName.tab_pages_.ToString() + shareName];

                //set numeric share value
                num = (NumericUpDown)tab.Controls[ControlName.num_.ToString() + shareName];
                if (isSavePosition)
                {
                    commShare.ShareValue = num.Value;
                }
                else
                {
                    num.Value = commShare.ShareValue;
                }

                //add textboxdesc
                txt = (TextBox)tab.Controls[ControlName.txt_.ToString() + shareName];
                if (isSavePosition)
                {
                    commShare.ShareDesc = txt.Text;
                }
                else
                {
                    txt.Text = commShare.ShareDesc;
                }

                if (isSavePosition)
                {
                    commShare.CommissionId = CommissionId;
                    commShare.ShareTo      = shareName;
                    DataMaster.SaveOrUpdate(commShare);
                }
            }
        }
 private void SaveStock()
 {
     for (int i = 0; i < tStockDataGridView.RowCount; i++)
     {
         TStock s = new TStock();
         s.ItemId         = tStockDataGridView.Rows[i].Cells[2].Value.ToString();
         s.StockBarcodeId = tStockDataGridView.Rows[i].Cells[0].Value.ToString();
         s.StockLocation  = tStockDataGridView.Rows[i].Cells[1].Value.ToString();
         DataMaster.SaveOrUpdate(s);
     }
 }
Exemple #3
0
        private void bindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                return;
            }

            if (!(itemTypeIdLabel1.Text.Trim().Equals("0") || string.IsNullOrEmpty(itemTypeIdLabel1.Text.Trim())))
            {
                tipe = (MItemType)DataMaster.GetObjectByProperty(typeof(MItemType), MItemType.ColumnNames.ItemTypeId, int.Parse(itemTypeIdLabel1.Text));
            }
            else
            {
                tipe = new MItemType();
            }

            tipe.ItemTypeName = itemTypeNameTextBox.Text;
            tipe.ModifiedBy   = lbl_UserName.Text;
            tipe.ModifiedDate = DateTime.Now;

            DataMaster.SaveOrUpdate(tipe);

            ModuleControlSettings.SaveLog(ListOfAction.Update, itemTypeNameTextBox.Text, ListOfTable.MGroup, lbl_UserName.Text);
            BindData();
        }
Exemple #4
0
        private void bindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                return;
            }

            if (!(groupIdLabel1.Text.Trim().Equals("0") || string.IsNullOrEmpty(groupIdLabel1.Text.Trim())))
            {
                group = (MGroup)DataMaster.GetObjectById(typeof(MGroup), Convert.ToInt32(groupIdLabel1.Text));
            }
            else
            {
                group = new MGroup();
            }

            group.GroupName    = groupNameTextBox.Text;
            group.ModifiedBy   = lbl_UserName.Text;
            group.ModifiedDate = DateTime.Now;

            DataMaster.SaveOrUpdate(group);

            ModuleControlSettings.SaveLog(ListOfAction.Update, groupNameTextBox.Text, ListOfTable.MGroup, lbl_UserName.Text);
            BindData();
        }
Exemple #5
0
        public static string GetVoucherNo()
        {
            string voucherFrontString = "V/" + DateTime.Now.Year.ToString() + "/";
            int    voucherLength      = 8;
            string lastVoucher;
            string VoucherNo = "VoucherNo";

            DataMasterMgtServices DataMaster = new DataMasterMgtServices();
            TReference            refer      = (TReference)DataMaster.GetObjectByProperty(typeof(TReference), TReference.ColumnNames.ReferenceType, VoucherNo);

            if (refer == null)
            {
                refer       = new TReference();
                lastVoucher = decimal.Zero.ToString();
            }
            else
            {
                lastVoucher = refer.NextId.Substring(refer.NextId.Length - voucherLength, voucherLength);
                //voucherLength = voucherLength - 1;
            }

            decimal nextNumVoucher = Convert.ToDecimal(lastVoucher) + 1;
            string  nextVoucher    = nextNumVoucher.ToString();

            for (int i = 0; i < voucherLength - nextNumVoucher.ToString().Length; i++)
            {
                nextVoucher = "0" + nextVoucher;
            }
            nextVoucher = voucherFrontString + nextVoucher;

            refer.NextId        = nextVoucher;
            refer.ReferenceType = VoucherNo;
            DataMaster.SaveOrUpdate(refer);
            return(nextVoucher);
        }
        private void bindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                return;
            }

            if (!(groupIdLabel1.Text.Trim().Equals("0") || string.IsNullOrEmpty(groupIdLabel1.Text.Trim())))
            {
                group = (MGroup)DataMaster.GetObjectByProperty(typeof(MGroup), MGroup.ColumnNames.GroupId, Convert.ToInt32(groupIdLabel1.Text));
            }
            else
            {
                group = new MGroup();
            }

            //group.GroupId = Convert.ToInt32(groupIdLabel1.Text);
            group.GroupName = groupNameTextBox.Text;

            group.ModifiedBy   = lbl_UserName.Text;
            group.ModifiedDate = DateTime.Now;

            DataMaster.SaveOrUpdate(group);

            BindData();
        }
Exemple #7
0
        internal static string GetNewId(Type tipe)
        {
            DataMasterMgtServices DataMaster = new DataMasterMgtServices();
            TReference            refer      = (TReference)DataMaster.GetObjectByProperty(typeof(TReference), TReference.ColumnNames.ReferenceType, tipe.Name.ToString());
            int    length = 8;//int.Parse(ConfigurationManager.AppSettings["IdLength"]);
            string result = string.Empty;
            string lastId = string.Empty;

            if (refer == null)
            {
                refer  = new TReference();
                lastId = decimal.Zero.ToString();
            }
            else
            {
                lastId = refer.NextId;
            }

            decimal nextId = Convert.ToDecimal(lastId) + 1;

            for (int i = 0; i < length - nextId.ToString().Length; i++)
            {
                result = "0" + result;
            }
            result = tipe.Name.ToString().Substring(1, tipe.Name.ToString().Length - 1) + result + nextId.ToString();

            refer.NextId        = nextId.ToString();
            refer.ReferenceType = tipe.Name.ToString();
            DataMaster.SaveOrUpdate(refer);
            return(result);
        }
Exemple #8
0
        private void SaveOrUpdateDeliveryDetail()
        {
            TTransactionDeliveryDetail deldet;
            string  itemId;
            decimal qty, transDetId, delDetId;

            for (int i = 0; i < tTransactionDeliveryDetailDataGridView.RowCount; i++)
            {
                if (Convert.ToBoolean(tTransactionDeliveryDetailDataGridView.Rows[i].Cells[0].Value))
                {
                    itemId     = tTransactionDeliveryDetailDataGridView.Rows[i].Cells[1].Value.ToString();
                    qty        = Convert.ToDecimal(tTransactionDeliveryDetailDataGridView.Rows[i].Cells[5].Value);
                    transDetId = Convert.ToDecimal(tTransactionDeliveryDetailDataGridView.Rows[i].Cells[6].Value);
                    delDetId   = Convert.ToDecimal(tTransactionDeliveryDetailDataGridView.Rows[i].Cells[7].Value);
                    if (isInEdit)
                    {
                        deldet = (TTransactionDeliveryDetail)DataMaster.GetObjectByProperty(typeof(TTransactionDeliveryDetail), TTransactionDeliveryDetail.ColumnNames.DeliveryDetailId, delDetId, TTransactionDeliveryDetail.ColumnNames.TransactionDetailId, transDetId);
                        if (deldet == null)
                        {
                            deldet = new TTransactionDeliveryDetail();
                        }
                        else
                        {
                            UpdateStok(false, 1, itemId, deldet.DeliveryDetailQuantity, false);
                        }
                    }
                    else
                    {
                        deldet = new TTransactionDeliveryDetail();
                    }

                    deldet.DeliveryDetailDesc     = string.Empty;
                    deldet.DeliveryDetailItemId   = itemId;
                    deldet.DeliveryDetailQuantity = qty;
                    deldet.DeliveryId             = delId;
                    deldet.TransactionDetailId    = transDetId;
                    deldet.ModifiedBy             = lbl_UserName.Text;
                    deldet.ModifiedDate           = DateTime.Now;
                    DataMaster.SaveOrUpdate(deldet);


                    UpdateStok(false, 1, itemId, qty, true);
                }
            }
        }
Exemple #9
0
        private void SaveRekap(listAcc acc, string desc, decimal salesTot)
        {
            //period = numericUpDown_Year.Value.ToString() + comboBox_Month.SelectedValue.ToString();
            TRekapSubAccount rekap = (TRekapSubAccount)DataMaster.GetObjectByProperty(typeof(TRekapSubAccount), TRekapSubAccount.ColumnNames.RekapSubAccountPeriode, period, TRekapSubAccount.ColumnNames.SubAccountId, acc.ToString());

            if (rekap == null)
            {
                rekap = new TRekapSubAccount();
            }

            rekap.ModifiedBy             = lbl_UserName.Text;
            rekap.ModifiedDate           = DateTime.Now;
            rekap.RekapSubaccountDesc    = desc;
            rekap.RekapSubAccountPeriode = period;
            rekap.RekapSubaccountSaldo   = salesTot;
            rekap.SubAccountId           = acc.ToString();
            DataMaster.SaveOrUpdate(rekap);
        }
Exemple #10
0
        public static string GenerateFacturNo(ListOfTransaction tr, string DeskNo)
        {
            DataMasterMgtServices DataMaster = new DataMasterMgtServices();
            MSetting   set   = (MSetting)DataMaster.GetObjectById(typeof(MSetting), AssemblyProduct);
            TReference refer = (TReference)DataMaster.GetObjectByProperty(typeof(TReference), TReference.ColumnNames.ReferenceType, tr.ToString());

            if (refer == null)
            {
                refer        = new TReference();
                refer.NextId = decimal.Zero.ToString();
            }

            string  facturNoTemplate = set.FacturNoFormat;
            decimal no  = Convert.ToDecimal(refer.NextId) + 1;
            int     len = set.FacturNoLength - no.ToString().Length;

            string factur = no.ToString();

            for (int i = 0; i < len; i++)
            {
                factur = "0" + factur;
            }

            refer.NextId        = no.ToString();
            refer.ReferenceType = tr.ToString();
            DataMaster.SaveOrUpdate(refer);

            string tipeTrans = string.Empty;

            char[] charTransArray = tr.ToString().ToCharArray();
            char   charTrans;

            for (int i = 0; i < tr.ToString().Length; i++)
            {
                charTrans = charTransArray[i];
                if (char.IsUpper(tr.ToString(), i))
                {
                    tipeTrans += tr.ToString().Substring(i, 1);
                }
            }

            return(facturNoTemplate.Replace("[xxx]", factur).Replace("[meja]", DeskNo).Replace("[tanggal]", DateTime.Now.Day.ToString()).Replace("[bulan]", DateTime.Now.Month.ToString()).Replace("[tahun]", DateTime.Now.Year.ToString()).Replace("[Tipe]", tipeTrans));
        }
Exemple #11
0
        public static string GetLabaDitahanAccountNo()
        {
            string LabaDitahanAccountNo        = "LabaDitahanAccountNo";
            string defaultLabaDitahanAccountNo = "510LAB001";
            DataMasterMgtServices DataMaster   = new DataMasterMgtServices();
            TReference            refer        = (TReference)DataMaster.GetObjectByProperty(typeof(TReference), TReference.ColumnNames.ReferenceType, LabaDitahanAccountNo);

            if (refer == null)
            {
                refer = new TReference();
                refer.ReferenceType = LabaDitahanAccountNo;
                refer.NextId        = defaultLabaDitahanAccountNo;
                DataMaster.SaveOrUpdate(refer);
            }
            else
            {
                defaultLabaDitahanAccountNo = refer.NextId;
            }

            return(defaultLabaDitahanAccountNo);
        }
Exemple #12
0
        public static string GetPPNPurchaseAccountNo()
        {
            string PPNPurchaseAccountNo        = "PPNPurchase";
            string defaultPPNPurchaseAccountNo = "320PPN001";
            DataMasterMgtServices DataMaster   = new DataMasterMgtServices();
            TReference            refer        = (TReference)DataMaster.GetObjectByProperty(typeof(TReference), TReference.ColumnNames.ReferenceType, PPNPurchaseAccountNo);

            if (refer == null)
            {
                refer = new TReference();
                refer.ReferenceType = PPNPurchaseAccountNo;
                refer.NextId        = defaultPPNPurchaseAccountNo;
                DataMaster.SaveOrUpdate(refer);
            }
            else
            {
                defaultPPNPurchaseAccountNo = refer.NextId;
            }

            return(defaultPPNPurchaseAccountNo);
        }
Exemple #13
0
        public static string GetBiayaStokAccountNo()
        {
            string BiayaStokAccountNo        = "BiayaStokAccountNo";
            string defaultBiayaStokAccountNo = "830STO001";
            DataMasterMgtServices DataMaster = new DataMasterMgtServices();
            TReference            refer      = (TReference)DataMaster.GetObjectByProperty(typeof(TReference), TReference.ColumnNames.ReferenceType, BiayaStokAccountNo);

            if (refer == null)
            {
                refer = new TReference();
                refer.ReferenceType = BiayaStokAccountNo;
                refer.NextId        = defaultBiayaStokAccountNo;
                DataMaster.SaveOrUpdate(refer);
            }
            else
            {
                defaultBiayaStokAccountNo = refer.NextId;
            }

            return(defaultBiayaStokAccountNo);
        }
Exemple #14
0
        public static string GetOtherRevenueAccountNo()
        {
            string OtherRevenueAccountNo        = "OtherRevenueAccountNo";
            string defaultOtherRevenueAccountNo = "680";
            DataMasterMgtServices DataMaster    = new DataMasterMgtServices();
            TReference            refer         = (TReference)DataMaster.GetObjectByProperty(typeof(TReference), TReference.ColumnNames.ReferenceType, OtherRevenueAccountNo);

            if (refer == null)
            {
                refer = new TReference();
                refer.ReferenceType = OtherRevenueAccountNo;
                refer.NextId        = defaultOtherRevenueAccountNo;
                DataMaster.SaveOrUpdate(refer);
            }
            else
            {
                defaultOtherRevenueAccountNo = refer.NextId;
            }

            return(defaultOtherRevenueAccountNo);
        }
Exemple #15
0
        public static string GetHutangEkspedisiAccountNo()
        {
            string HutangEkspedisiAccountNo        = "HutangEkspedisiAccountNo";
            string defaultHutangEkspedisiAccountNo = "400HUT002";
            DataMasterMgtServices DataMaster       = new DataMasterMgtServices();
            TReference            refer            = (TReference)DataMaster.GetObjectByProperty(typeof(TReference), TReference.ColumnNames.ReferenceType, HutangEkspedisiAccountNo);

            if (refer == null)
            {
                refer = new TReference();
                refer.ReferenceType = HutangEkspedisiAccountNo;
                refer.NextId        = defaultHutangEkspedisiAccountNo;
                DataMaster.SaveOrUpdate(refer);
            }
            else
            {
                defaultHutangEkspedisiAccountNo = refer.NextId;
            }

            return(defaultHutangEkspedisiAccountNo);
        }
Exemple #16
0
        public static string GetIkhtiarRLAccountNo()
        {
            string IkhtiarRLAccountNo        = "IkhtiarRLAccountNo";
            string defaultIkhtiarRLAccountNo = "1000-RL001";
            DataMasterMgtServices DataMaster = new DataMasterMgtServices();
            TReference            refer      = (TReference)DataMaster.GetObjectByProperty(typeof(TReference), TReference.ColumnNames.ReferenceType, IkhtiarRLAccountNo);

            if (refer == null)
            {
                refer = new TReference();
            }
            else
            {
                defaultIkhtiarRLAccountNo = refer.NextId;
            }

            refer.ReferenceType = IkhtiarRLAccountNo;
            refer.NextId        = defaultIkhtiarRLAccountNo;
            DataMaster.SaveOrUpdate(refer);
            return(defaultIkhtiarRLAccountNo);
        }
        private void bindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                return;
            }

            if (!groupIdLabel1.Text.Trim().Equals("0"))
            {
                group = (MGroup)DataMaster.GetObjectById(typeof(MGroup), Convert.ToInt32(groupIdLabel1.Text));
            }
            else
            {
                group = new MGroup();
            }

            group.GroupId   = Convert.ToInt32(groupIdLabel1.Text);
            group.GroupName = groupNameTextBox.Text;

            DataMaster.SaveOrUpdate(group);

            BindData();
        }
        private void bindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                return;
            }

            if (!(gudangIdLabel1.Text.Trim().Equals("0") || string.IsNullOrEmpty(gudangIdLabel1.Text.Trim())))
            {
                gud = (MGudang)DataMaster.GetObjectByProperty(typeof(MGudang), MGudang.ColumnNames.GudangId, Convert.ToInt32(gudangIdLabel1.Text));
            }
            else
            {
                gud = new MGudang();
            }

            gud.GudangName   = gudangNameTextBox.Text;
            gud.ModifiedBy   = lbl_UserName.Text;
            gud.ModifiedDate = DateTime.Now;

            DataMaster.SaveOrUpdate(gud);
            ModuleControlSettings.SaveLog(ListOfAction.Update, gudangNameTextBox.Text, ListOfTable.MGudang, lbl_UserName.Text);
            BindData();
        }
Exemple #19
0
        private void bindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                return;
            }

            bool isSave = false;

            //if (bankIdComboBox.Enabled)
            //{
            //    giro = new TGiro();
            //    isSave = true;
            //}
            //else
            //{
            //    giro = (TGiro)DataMaster.GetObjectByProperty(typeof(TGiro), TGiro.ColumnNames.GiroNo, giroNoTextBox.Text, TGiro.ColumnNames.BankId, bankIdComboBox.SelectedValue.ToString());
            //    isSave = false;
            //}

            if (giroIdNumericUpDown.Value != 0)
            {
                giro   = (TGiro)DataMaster.GetObjectByProperty(typeof(TGiro), TGiro.ColumnNames.GiroId, giroIdNumericUpDown.Value);
                isSave = false;
            }
            else
            {
                giro   = new TGiro();
                isSave = true;
            }

            giro.CurrencyId = currencyIdComboBox.SelectedItem.ToString();
            giro.BankId     = bankIdComboBox.SelectedValue.ToString();

            giro.GiroAmmount      = giroAmmountNumericUpDown.Value;
            giro.GiroCairDate     = giroCairDateDateTimePicker.Value;
            giro.GiroTo           = combo_Supplier.SelectedValue.ToString();
            giro.GiroMaturityDate = giroMaturityDateDateTimePicker.Value;
            giro.GiroNo           = giroNoTextBox.Text;

            if (isSave)
            {
                giro.GiroStatus  = ListOfGiroStatus.Baru.ToString();
                giro.GiroOutDate = DateTime.Now;
            }
            else
            {
                giro.GiroStatus = giroStatusLabel1.Text;
            }

            giro.ModifiedBy   = lbl_UserName.Text;
            giro.ModifiedDate = DateTime.Now;

            DataMaster.SaveOrUpdate(giro);
            if (isSave)
            {
                //try
                //{
                //    DataMaster.SavePersistence(giro);
                //}
                //catch (NHibernate.NonUniqueObjectException)
                //{
                //    RecreateBalloon();
                //    balloonHelp.Caption = "Validasi data kurang";
                //    balloonHelp.Content = "Nomor giro " + giroNoTextBox.Text + " sudah pernah diinput, silahkan input dengan nomor yang lain";
                //    balloonHelp.ShowBalloon(giroNoTextBox);
                //    giroNoTextBox.Focus();
                //    return;
                //}
                ModuleControlSettings.SaveLog(ListOfAction.Insert, bankIdComboBox.SelectedValue.ToString() + ";" + giroNoTextBox.Text + ";" + ListOfGiroStatus.Baru.ToString(), ListOfTable.TGiro, lbl_UserName.Text);
            }
            else
            {
                //DataMaster.UpdatePersistence(giro);
                ModuleControlSettings.SaveLog(ListOfAction.Update, bankIdComboBox.SelectedValue.ToString() + ";" + giroNoTextBox.Text + ";" + giroStatusLabel1.Text, ListOfTable.TGiro, lbl_UserName.Text);
            }

            BindGiroData();
            CalculateTotalUtang();
        }