Exemple #1
0
    void OnClickLearn(ButtonScript obj, object args, int param1, int param2)
    {
        itemId = param2;
        if (param1 == 1)
        {
            if (SkillData.GetMinxiLevelData(skillIds[param2])._Name.Equals(LanguageManager.instance.GetValue("playerPro_Attack")) || SkillData.GetMinxiLevelData(skillIds[param2])._Name.Equals(LanguageManager.instance.GetValue("playerPro_Defense")))
            {
                PopText.Instance.Show(LanguageManager.instance.GetValue("skillDontReplace"), PopText.WarningType.WT_Tip);
            }
            else
            {
                GuideManager.Instance.ClearMask();
                skillDecObj.SetActive(true);
                BabySkillEnter ben       = skillDecObj.GetComponent <BabySkillEnter>();
                SkillData      newSkdata = SkillData.GetData(BabySkillLearning.SkillId, BabySkillLearning.newLevel);
                SkillData      oldSkdata = SkillData.GetMinxiLevelData(skillIds[param2]);
                ben.newData       = newSkdata;
                ben.curData       = oldSkdata;
                ben.newSkillId    = BabySkillLearning.SkillId;
                ben.newSkillLevel = BabySkillLearning.newLevel;
                ben.oldskillId    = skillIds[param2];
//
//
//                MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("IsReplaceSkill"), () =>
//                {
//					if(GamePlayer.Instance.Properties[(int)PropertyType.PT_Money]<BabySkillLearning.Price)
//					{
//						//ErrorTipsUI.ShowMe("金币不足");
//                        PopText.Instance.Show(LanguageManager.instance.GetValue("nomoney"));
//					}else if(!IsArrivalsLevel())
//					{
//						//ErrorTipsUI.ShowMe("等级不足");
//                        PopText.Instance.Show(LanguageManager.instance.GetValue("EN_OpenBaoXiangLevel"));
//					}else
//					{
//						if(param2>=skillDatas.Count)
//						{
//							NetConnection.Instance.babyLearnSkill((uint)BabyList.babyId,0,(uint)BabySkillLearning.SkillId,(uint)BabySkillLearning.newLevel);
//						}else
//						{
//							NetConnection.Instance.babyLearnSkill((uint)BabyList.babyId,(uint)skillIds[param2],(uint)BabySkillLearning.SkillId,(uint)BabySkillLearning.newLevel);
//						}
//
//
//					}
//
//				});
            }
        }
        else if (param1 == 2)
        {
            MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("learnNewSkill"), () =>
            {
                if (GamePlayer.Instance.Properties[(int)PropertyType.PT_Money] < BabySkillLearning.Price)
                {
                    PopText.Instance.Show(LanguageManager.instance.GetValue("nomoney"));
                }
                else if (!IsArrivalsLevel())
                {
                    PopText.Instance.Show(LanguageManager.instance.GetValue("chongwudengjibuzu"));
                }
                else
                {
                    if (param2 >= skillDatas.Count)
                    {
                        NetConnection.Instance.babyLearnSkill((uint)BabyList.babyId, 0, (uint)BabySkillLearning.SkillId, (uint)BabySkillLearning.newLevel);
                    }
                    else
                    {
                        NetConnection.Instance.babyLearnSkill((uint)BabyList.babyId, (uint)skillIds[param2], (uint)BabySkillLearning.SkillId, (uint)BabySkillLearning.newLevel);
                    }
                }
            });
        }
    }
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (decimal.Parse(txtQty.Text) == 0)
                {
                    MessageBoxUI _mbStatus = new MessageBoxUI("Qty must not be Zero(0)!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mbStatus.ShowDialog();
                    return;
                }

                lRecordData[0] = lDetailId;
                try
                {
                    lRecordData[1] = cboStockDescription.SelectedValue.ToString();
                }
                catch
                {
                    MessageBoxUI _mbStatus = new MessageBoxUI("You must select a correct Stock!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mbStatus.ShowDialog();
                    cboStockDescription.Focus();
                    return;
                }
                lRecordData[2] = txtStockCode.Text;
                lRecordData[3] = cboStockDescription.Text;
                lRecordData[4] = txtUnit.Text;
                try
                {
                    lRecordData[5] = cboLocation.SelectedValue.ToString();
                }
                catch
                {
                    lRecordData[5] = "";
                }
                lRecordData[6]  = cboLocation.Text;
                lRecordData[7]  = string.Format("{0:n}", decimal.Parse(txtQty.Text));
                lRecordData[8]  = string.Format("{0:n}", decimal.Parse(txtUnitPrice.Text));
                lRecordData[9]  = string.Format("{0:n}", decimal.Parse(txtTotalPrice.Text));
                lRecordData[10] = GlobalFunctions.replaceChar(txtRemarks.Text);

                object[] _params = { lRecordData };
                if (lOperator == "Add")
                {
                    lRecordData[11] = "Add";
                    ParentList.GetType().GetMethod("addData").Invoke(ParentList, _params);
                    //MessageBoxUI _mbStatus = new MessageBoxUI("Successfully added!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK);
                    //_mbStatus.ShowDialog();
                    clear();
                }
                else if (lOperator == "Edit")
                {
                    lRecordData[11] = "Edit";
                    ParentList.GetType().GetMethod("updateData").Invoke(ParentList, _params);
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click");
                em.ShowDialog();
                return;
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (decimal.Parse(txtTotalQtyOut.Text) == 0)
                {
                    MessageBoxUI _mb1 = new MessageBoxUI("Totals of Qty must not be Zero(0)!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb1.showDialog();
                    return;
                }
                string _CustomerId = "";
                try
                {
                    _CustomerId = cboCustomer.SelectedValue.ToString();
                }
                catch
                {
                    _CustomerId = "";
                }
                DialogResult _dr = new DialogResult();
                MessageBoxUI _mb = new MessageBoxUI("Continue saving this Stock Withdrawal?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo);
                _mb.ShowDialog();
                _dr = _mb.Operation;
                if (_dr == DialogResult.Yes)
                {
                    loInventory.Id   = lInventoryId;
                    loInventory.Date = dtpDate.Value;
                    loInventory.Type = "Stock Withdrawal";
                    loInventory.POId = "";
                    try
                    {
                        loInventory.SOId = cboSalesOrder.Text;
                    }
                    catch
                    {
                        loInventory.SOId = "";
                    }
                    loInventory.STInId         = "";
                    loInventory.STOutId        = "";
                    loInventory.Reference      = GlobalFunctions.replaceChar(txtReference.Text);
                    loInventory.CustomerId     = _CustomerId;
                    loInventory.SupplierId     = "0";
                    loInventory.TotalPOQty     = 0;
                    loInventory.TotalQtyIn     = 0;
                    loInventory.TotalSOQty     = decimal.Parse(txtTotalSOQty.Text);
                    loInventory.TotalQtyOut    = decimal.Parse(txtTotalQtyOut.Text);
                    loInventory.TotalVariance  = decimal.Parse(txtTotalVariance.Text);
                    loInventory.FromLocationId = "";
                    loInventory.ToLocationId   = "";
                    loInventory.Remarks        = GlobalFunctions.replaceChar(txtRemarks.Text);
                    loInventory.UserId         = GlobalVariables.UserId;

                    try
                    {
                        string _InventoryId = loInventory.save(lOperation);
                        if (_InventoryId != "")
                        {
                            for (int i = 0; i < dgvDetail.Rows.Count; i++)
                            {
                                if (dgvDetail.Rows[i].Cells["Status"].Value.ToString() == "Add")
                                {
                                    try
                                    {
                                        loInventoryDetail.DetailId = dgvDetail.Rows[i].Cells[0].Value.ToString();
                                    }
                                    catch
                                    {
                                        loInventoryDetail.DetailId = "";
                                    }
                                    try
                                    {
                                        loInventoryDetail.InventoryId = _InventoryId;
                                        loInventoryDetail.PODetailId  = "0";
                                        loInventoryDetail.SODetailId  = dgvDetail.Rows[i].Cells[1].Value.ToString();
                                        loInventoryDetail.StockId     = dgvDetail.Rows[i].Cells[2].Value.ToString();
                                        loInventoryDetail.LocationId  = dgvDetail.Rows[i].Cells[6].Value.ToString();
                                        loInventoryDetail.POQty       = 0;
                                        loInventoryDetail.QtyIn       = 0;
                                        loInventoryDetail.SOQty       = decimal.Parse(dgvDetail.Rows[i].Cells[8].Value.ToString());
                                        loInventoryDetail.QtyOut      = decimal.Parse(dgvDetail.Rows[i].Cells[9].Value.ToString());
                                        loInventoryDetail.Variance    = decimal.Parse(dgvDetail.Rows[i].Cells[10].Value.ToString());
                                        loInventoryDetail.Remarks     = dgvDetail.Rows[i].Cells[11].Value.ToString();
                                        loInventoryDetail.UserId      = GlobalVariables.UserId;
                                        loInventoryDetail.save(GlobalVariables.Operation.Add);
                                    }
                                    catch { }
                                }
                                else if (dgvDetail.Rows[i].Cells["Status"].Value.ToString() == "Edit")
                                {
                                    try
                                    {
                                        loInventoryDetail.DetailId = dgvDetail.Rows[i].Cells[0].Value.ToString();
                                    }
                                    catch
                                    {
                                        loInventoryDetail.DetailId = "";
                                    }
                                    try
                                    {
                                        loInventoryDetail.InventoryId = _InventoryId;
                                        loInventoryDetail.PODetailId  = "0";
                                        loInventoryDetail.SODetailId  = dgvDetail.Rows[i].Cells[1].Value.ToString();
                                        loInventoryDetail.StockId     = dgvDetail.Rows[i].Cells[2].Value.ToString();
                                        loInventoryDetail.LocationId  = dgvDetail.Rows[i].Cells[6].Value.ToString();
                                        loInventoryDetail.POQty       = 0;
                                        loInventoryDetail.QtyIn       = 0;
                                        loInventoryDetail.SOQty       = decimal.Parse(dgvDetail.Rows[i].Cells[8].Value.ToString());
                                        loInventoryDetail.QtyOut      = decimal.Parse(dgvDetail.Rows[i].Cells[9].Value.ToString());
                                        loInventoryDetail.Variance    = decimal.Parse(dgvDetail.Rows[i].Cells[10].Value.ToString());
                                        loInventoryDetail.Remarks     = dgvDetail.Rows[i].Cells[11].Value.ToString();
                                        loInventoryDetail.UserId      = GlobalVariables.UserId;
                                        loInventoryDetail.save(GlobalVariables.Operation.Edit);
                                    }
                                    catch { }
                                }
                                else if (dgvDetail.Rows[i].Cells["Status"].Value.ToString() == "Delete")
                                {
                                    loInventoryDetail.remove(dgvDetail.Rows[i].Cells[0].Value.ToString());
                                }
                            }
                            if (txtId.Text == _InventoryId)
                            {
                                MessageBoxUI _mb2 = new MessageBoxUI("Stock Withdrawal has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK);
                                _mb2.showDialog();
                            }
                            else
                            {
                                MessageBoxUI _mb2 = new MessageBoxUI("Stock Withdrawal has been saved successfully! New Stock Withdrawal Id : " + _InventoryId, GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK);
                                _mb2.showDialog();
                            }

                            //previewDetail(_InventoryId);

                            object[] _params = { "Stock Withdrawal" };
                            ParentList.GetType().GetMethod("refresh").Invoke(ParentList, _params);
                            this.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        if (ex.Message.Contains("Unclosed quotation mark after the character string"))
                        {
                            MessageBoxUI _mb3 = new MessageBoxUI("Do not use this character( ' ).", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                            _mb3.showDialog();
                            return;
                        }
                        else
                        {
                            MessageBoxUI _mb3 = new MessageBoxUI(ex.Message, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                            _mb3.showDialog();
                            return;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click");
                em.ShowDialog();
                return;
            }
        }
Exemple #4
0
        private void loadCompanyInfo()
        {
            try
            {
                foreach (DataRow _drSystemConfig in loSystemConfiguration.getAllData().Rows)
                {
                    if (_drSystemConfig["Key"].ToString() == "ApplicationName")
                    {
                        GlobalVariables.ApplicationName = _drSystemConfig["Value"].ToString();
                        lblApplicationName.Text         = _drSystemConfig["Value"].ToString();
                    }
                    else if (_drSystemConfig["Key"].ToString() == "VersionNo")
                    {
                        GlobalVariables.VersionNo = _drSystemConfig["Value"].ToString();
                    }
                    else if (_drSystemConfig["Key"].ToString() == "CompanyName")
                    {
                        GlobalVariables.CompanyName = _drSystemConfig["Value"].ToString();
                        lblCompanyName.Text         = GlobalVariables.CompanyName;
                    }
                    else if (_drSystemConfig["Key"].ToString() == "CompanyAddress")
                    {
                        GlobalVariables.CompanyAddress = _drSystemConfig["Value"].ToString();
                        lblCompanyAddress.Text         = _drSystemConfig["Value"].ToString();
                    }
                    else if (_drSystemConfig["Key"].ToString() == "ContactNumber")
                    {
                        GlobalVariables.ContactNumber = _drSystemConfig["Value"].ToString();
                    }
                    else if (_drSystemConfig["Key"].ToString() == "TechnicalSupportEmailAddress")
                    {
                        GlobalVariables.TechnicalSupportEmailAddress = _drSystemConfig["Value"].ToString();
                    }
                    else if (_drSystemConfig["Key"].ToString() == "BannerImage")
                    {
                        byte[] hextobyteLogo = GlobalFunctions.HexToBytes(_drSystemConfig["Value"].ToString());
                        pctBannerImage.BackgroundImage = GlobalFunctions.ConvertByteArrayToImage(hextobyteLogo);
                    }
                    else if (_drSystemConfig["Key"].ToString() == "PrimaryColor")
                    {
                        GlobalVariables.PrimaryColor = _drSystemConfig["Value"].ToString();
                        pnlApplicationName.BackColor = Color.FromArgb(int.Parse(GlobalVariables.PrimaryColor));
                        lblLicenseTo.BackColor       = Color.FromArgb(int.Parse(GlobalVariables.PrimaryColor));
                    }
                    else if (_drSystemConfig["Key"].ToString() == "SecondaryColor")
                    {
                        GlobalVariables.SecondaryColor = _drSystemConfig["Value"].ToString();
                        pnlCompanyDetails.BackColor    = Color.FromArgb(int.Parse(GlobalVariables.SecondaryColor));
                    }
                    else if (_drSystemConfig["Key"].ToString() == "FormBackColor")
                    {
                        GlobalVariables.FormBackColor = _drSystemConfig["Value"].ToString();
                    }
                }

                if (GlobalVariables.VersionNo != lblVersionNo.Text)
                {
                    //TO BE UPDATED
                    //Process.Start("D:/PERSONAL FILES/Softwares- JBC Active/JBC SOFTWARES/JBC Softwares/JBC Softwares - V/Framework/Main/text/copy.bat");
                    //Process.Start(".../Main/text/copy.bat");
                    MessageBoxUI ms = new MessageBoxUI(GlobalVariables.VersionNo + " is available now in the Google Drive. Please update immediately!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                    ms.showDialog();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #5
0
        private void btnProcess_Click(object sender, EventArgs e)
        {
            if (decimal.Parse(lblChange.Text) < 0)
            {
                MessageBoxUI mb = new MessageBoxUI("Amount rendered must be greater than Total Due!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                mb.showDialog();
                txtAmountRendered.Focus();
                return;
            }
            lFromClose                       = false;
            loPOSTransaction.Id              = lTransactionId;
            loPOSTransaction.Date            = DateTime.Now;
            loPOSTransaction.CashierPeriodId = GlobalVariables.CashierPeriodId;
            loPOSTransaction.CustomerId      = lCustomerId;
            loPOSTransaction.OrderType       = lOrderType;
            loPOSTransaction.TableId         = lTableId;
            loPOSTransaction.ORNo            = txtORNo.Text;
            loPOSTransaction.TotalPrice      = decimal.Parse(lblTotalPrice.Text);
            loPOSTransaction.TotalDiscount   = decimal.Parse(lblTotalDiscount.Text);
            loPOSTransaction.TotalLessVAT    = decimal.Parse(lblLessVAT.Text);
            loPOSTransaction.TotalDue        = decimal.Parse(lblTotalDue.Text);
            loPOSTransaction.VATSale         = decimal.Parse(lblVATSale.Text);
            loPOSTransaction.VATExemptSale   = decimal.Parse(lblVATExemptSale.Text);
            loPOSTransaction.VATAmount       = decimal.Parse(lblVATAmount.Text);
            loPOSTransaction.AmountTendered  = decimal.Parse(txtAmountRendered.Text);
            loPOSTransaction.Paid            = "Y";
            loPOSTransaction.DiscountId      = lDiscountId;
            loPOSTransaction.ModeOfPaymentId = lModeOfPaymentId;
            loPOSTransaction.PaymentDetails  = lPaymentDetails;
            loPOSTransaction.OutletId        = GlobalVariables.CurrentLocationId;
            loPOSTransaction.CashierId       = GlobalVariables.CashierId;
            loPOSTransaction.Terminal        = GlobalVariables.Terminal;
            loPOSTransaction.Remarks         = lblRemarks.Text;
            loPOSTransaction.UserId          = GlobalVariables.UserId;
            try
            {
                string _TransactionId;
                if (lOperation == "Add")
                {
                    _TransactionId = loPOSTransaction.save(GlobalVariables.Operation.Add);
                }
                else if (lOperation == "Edit")
                {
                    _TransactionId = loPOSTransaction.save(GlobalVariables.Operation.Edit);
                }
                else
                {
                    MessageBoxUI _mb = new MessageBoxUI("Operation not defined!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    return;
                }
                if (_TransactionId != "")
                {
                    decimal _totalQty = 0;
                    foreach (DataGridViewRow _dr in loDataGrid.Rows)
                    {
                        loPOSTransactionDetail.TransactionId = _TransactionId;
                        loPOSTransactionDetail.StockId       = _dr.Cells["DetailStockId"].Value.ToString();
                        loPOSTransactionDetail.LocationId    = GlobalVariables.CurrentLocationId;
                        loPOSTransactionDetail.VATable       = "Y";
                        _totalQty += decimal.Parse(_dr.Cells["DetailQty"].Value.ToString());
                        loPOSTransactionDetail.Qty            = decimal.Parse(_dr.Cells["DetailQty"].Value.ToString());
                        loPOSTransactionDetail.UnitCost       = decimal.Parse(_dr.Cells["DetailUnitCost"].Value.ToString());
                        loPOSTransactionDetail.BasePrice      = decimal.Parse(_dr.Cells["DetailBasePrice"].Value.ToString());
                        loPOSTransactionDetail.UnitPrice      = decimal.Parse(_dr.Cells["DetailUnitPrice"].Value.ToString());
                        loPOSTransactionDetail.DiscountId     = "0";
                        loPOSTransactionDetail.DiscountAmount = 0;
                        loPOSTransactionDetail.TotalPrice     = decimal.Parse(_dr.Cells["DetailTotalPrice"].Value.ToString());
                        loPOSTransactionDetail.UserId         = GlobalVariables.UserId;

                        if (lOperation == "Add")
                        {
                            loPOSTransactionDetail.save(GlobalVariables.Operation.Add);
                        }
                        else if (lOperation == "Edit")
                        {
                            if (_dr.Cells[0].Value.ToString() != "")
                            {
                                loPOSTransactionDetail.DetailId = _dr.Cells["DetailId"].Value.ToString();
                                loPOSTransactionDetail.save(GlobalVariables.Operation.Edit);
                            }
                            else
                            {
                                loPOSTransactionDetail.save(GlobalVariables.Operation.Add);
                            }
                        }
                    }
                    //insert Inventory
                    loInventory.final(insertInventory(_TransactionId, lCustomerId, _totalQty));

                    try
                    {
                        OpenCashDrawer loOpenCashDrawer = new OpenCashDrawer();
                        loOpenCashDrawer.openCashDrawer();
                        this.Close();
                    }
                    catch (Exception ex)
                    {
                        MessageBoxUI mb = new MessageBoxUI(ex.Message, GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK);
                        mb.showDialog();
                    }
                    writeORSeqNo();

                    if (lOperation == "Add")
                    {
                        printOrderSlip(_TransactionId, txtORNo.Text);
                    }

                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBoxUI _mb = new MessageBoxUI(ex.Message, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                _mb.showDialog();
                return;
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (cboQty.Text == "")
                {
                    MessageBoxUI _mb = new MessageBoxUI("Qty must have a value!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    cboQty.Focus();
                    return;
                }
                if (cboSource.Text == "")
                {
                    MessageBoxUI _mb = new MessageBoxUI("Source must have a value!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    cboSource.Focus();
                    return;
                }

                loInventoryType.Id          = lId;
                loInventoryType.Description = GlobalFunctions.replaceChar(txtDescription.Text);
                loInventoryType.Qty         = cboQty.Text;
                loInventoryType.Source      = cboSource.Text;
                loInventoryType.Remarks     = GlobalFunctions.replaceChar(txtRemarks.Text);
                loInventoryType.UserId      = GlobalVariables.UserId;

                string _Id = loInventoryType.save(lOperation);
                if (_Id != "")
                {
                    MessageBoxUI _mb = new MessageBoxUI("Inventory Type has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    lRecords[0] = _Id;
                    lRecords[1] = txtDescription.Text;
                    lRecords[2] = cboQty.Text;
                    lRecords[3] = cboSource.Text;
                    lRecords[4] = txtRemarks.Text;
                    object[] _params = { lRecords };
                    if (lOperation == GlobalVariables.Operation.Edit)
                    {
                        ParentList.GetType().GetMethod("updateData").Invoke(ParentList, _params);
                        this.Close();
                    }
                    else
                    {
                        ParentList.GetType().GetMethod("addData").Invoke(ParentList, _params);
                        clear();
                    }
                }
                else
                {
                    MessageBoxUI _mb = new MessageBoxUI("Failure to save the record!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    return;
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click");
                em.ShowDialog();
                return;
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (decimal.Parse(txtTotalDebit.Text) != decimal.Parse(txtTotalCredit.Text))
            {
                MessageBoxUI _mb = new MessageBoxUI("Totals of Debit and Credit must be equal!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                _mb.showDialog();
                return;
            }
            if (decimal.Parse(txtTotalDebit.Text) == 0 && decimal.Parse(txtTotalCredit.Text) == 0)
            {
                MessageBoxUI _mb = new MessageBoxUI("Totals of Debit and Credit must not be Zero(0)!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                _mb.showDialog();
                return;
            }
            if (dtpDatePrepared.Value.Year != int.Parse(GlobalVariables.CurrentFinancialYear))
            {
                MessageBoxUI _mb = new MessageBoxUI("Date Prepared must be within Current Financial Year!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                _mb.showDialog();
                return;
            }
            loJournalEntry.JournalEntryId = lJournalEntryId;
            loJournalEntry.FinancialYear  = int.Parse(txtFinancialYear.Text);
            loJournalEntry.Journal        = "GJ";
            loJournalEntry.Form           = "JV";
            loJournalEntry.VoucherNo      = "";
            loJournalEntry.DatePrepared   = dtpDatePrepared.Value;
            loJournalEntry.Explanation    = GlobalFunctions.replaceChar(txtExplanation.Text);
            loJournalEntry.TotalDebit     = decimal.Parse(txtTotalDebit.Text);
            loJournalEntry.TotalCredit    = decimal.Parse(txtTotalCredit.Text);
            loJournalEntry.Reference      = "";
            loJournalEntry.SupplierId     = "";
            loJournalEntry.CustomerId     = "";
            loJournalEntry.BegBal         = chkBegBal.Checked ? "Y" : "N";
            loJournalEntry.Adjustment     = chkAdjustment.Checked ? "Y" : "N";
            loJournalEntry.ClosingEntry   = chkClosingEntry.Checked ? "Y" : "N";
            loJournalEntry.PreparedBy     = GlobalVariables.Username;
            loJournalEntry.Remarks        = GlobalFunctions.replaceChar(txtRemarks.Text);
            loJournalEntry.SOId           = "0";
            loJournalEntry.POId           = "0";
            loJournalEntry.UserId         = GlobalVariables.UserId;

            try
            {
                string _JournalEntryId = loJournalEntry.save(lOperation);
                if (_JournalEntryId != "")
                {
                    for (int i = 0; i < dgvDetail.Rows.Count; i++)
                    {
                        if (dgvDetail.Rows[i].Cells["Status"].Value.ToString() == "Add")
                        {
                            loJournalEntryDetail.DetailId              = dgvDetail.Rows[i].Cells["Id"].Value.ToString();
                            loJournalEntryDetail.JournalEntryId        = _JournalEntryId;
                            loJournalEntryDetail.AccountId             = dgvDetail.Rows[i].Cells["AccountId"].Value.ToString();
                            loJournalEntryDetail.Debit                 = decimal.Parse(dgvDetail.Rows[i].Cells["Debit"].Value.ToString());
                            loJournalEntryDetail.Credit                = decimal.Parse(dgvDetail.Rows[i].Cells["Credit"].Value.ToString());
                            loJournalEntryDetail.Subsidiary            = dgvDetail.Rows[i].Cells["Subsidiary"].Value.ToString();
                            loJournalEntryDetail.SubsidiaryId          = dgvDetail.Rows[i].Cells["SubsidiaryId"].Value.ToString();
                            loJournalEntryDetail.SubsidiaryDescription = dgvDetail.Rows[i].Cells["Description"].Value.ToString();
                            loJournalEntryDetail.Remarks               = dgvDetail.Rows[i].Cells["Remarks"].Value.ToString();
                            loJournalEntryDetail.UserId                = GlobalVariables.UserId;
                            loJournalEntryDetail.save(GlobalVariables.Operation.Add);
                        }
                        else if (dgvDetail.Rows[i].Cells["Status"].Value.ToString() == "Edit")
                        {
                            loJournalEntryDetail.DetailId              = dgvDetail.Rows[i].Cells["Id"].Value.ToString();
                            loJournalEntryDetail.JournalEntryId        = _JournalEntryId;
                            loJournalEntryDetail.AccountId             = dgvDetail.Rows[i].Cells["AccountId"].Value.ToString();
                            loJournalEntryDetail.Debit                 = decimal.Parse(dgvDetail.Rows[i].Cells["Debit"].Value.ToString());
                            loJournalEntryDetail.Credit                = decimal.Parse(dgvDetail.Rows[i].Cells["Credit"].Value.ToString());
                            loJournalEntryDetail.Subsidiary            = dgvDetail.Rows[i].Cells["Subsidiary"].Value.ToString();
                            loJournalEntryDetail.SubsidiaryId          = dgvDetail.Rows[i].Cells["SubsidiaryId"].Value.ToString();
                            loJournalEntryDetail.SubsidiaryDescription = dgvDetail.Rows[i].Cells["Description"].Value.ToString();
                            loJournalEntryDetail.Remarks               = dgvDetail.Rows[i].Cells["Remarks"].Value.ToString();
                            loJournalEntryDetail.UserId                = GlobalVariables.UserId;
                            loJournalEntryDetail.save(GlobalVariables.Operation.Edit);
                        }
                        else if (dgvDetail.Rows[i].Cells["Status"].Value.ToString() == "Delete")
                        {
                            loJournalEntryDetail.remove(dgvDetail.Rows[i].Cells[0].Value.ToString());
                        }
                    }

                    MessageBoxUI _mb = new MessageBoxUI("Journal Entry has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    try
                    {
                        if (lOperation == GlobalVariables.Operation.Edit)
                        {
                            //sendEmailForPosting(_JournalEntryId, cboCompany.SelectedValue.ToString(), cboCompany.Text, string.Format("{0:MM-dd-yyyy}", dtpDatePrepared.Value), txtExplanation.Text, decimal.Parse(txtTotalDebit.Text), decimal.Parse(txtTotalCredit.Text), GlobalVariables.Userfullname);
                        }
                    }
                    catch
                    {
                        MessageBoxUI _mb1 = new MessageBoxUI("Failure to send email", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                        _mb1.showDialog();
                    }
                    ParentList.GetType().GetMethod("refresh").Invoke(ParentList, null);

                    this.Close();
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("Unclosed quotation mark after the character string"))
                {
                    MessageBoxUI _mb = new MessageBoxUI("Do not use this character( ' ).", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    return;
                }
                else
                {
                    MessageBoxUI _mb = new MessageBoxUI(ex.Message, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    return;
                }
            }
        }
Exemple #8
0
    void OnClicLottery(ButtonScript obj, object args, int param1, int param2)
    {
        if (GamePlayer.Instance.EmployeeList.Count + 1 > 100)
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("EN_EmployeeIsFull"));
            showBuyBtn(true);
            return;
        }

        string numStr = "";

        if (btpye == BoxType.BX_Glod)
        {
            if (BagSystem.instance.GetItemMaxNum((uint)drawNeedItem_) >= drawNeedGoldNum_)
            {
                MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("xiaohaojizhnag").Replace("{n1}", drawNeedGoldNum_.ToString()).Replace("{n}", ItemData.GetData(drawNeedItem_).name_), () => {
                    NetConnection.Instance.drawLotteryBox(btpye, false);
                    LotteryBtn.isEnabled = false;
                    SetPrizeWinDisplay(false);
                });
            }

            else if (GamePlayer.Instance.GetIprop(PropertyType.PT_Diamond) >= drawNeedGoldZhuanNum_)
            {
                MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("chouxiaohanzs").Replace("{n}", drawNeedGoldZhuanNum_.ToString()), () => {
                    NetConnection.Instance.drawLotteryBox(btpye, false);
                    LotteryBtn.isEnabled = false;
                    SetPrizeWinDisplay(false);
                });
            }
            else if (GamePlayer.Instance.GetIprop(PropertyType.PT_MagicCurrency) >= drawNeedGoldZhuanNum_)
            {
                MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("xiaohaotimoli").Replace("{n}", drawNeedGoldZhuanNum_.ToString()), () => {
                    NetConnection.Instance.drawLotteryBox(btpye, false);
                    LotteryBtn.isEnabled = false;
                    SetPrizeWinDisplay(false);
                });
            }
            else
            {
                MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("daojubuzu"), () => { StoreUI.SwithShowMe(2); });
            }
            showBuyBtn(true);

            return;
        }
        else if (btpye == BoxType.BX_Blue)
        {
            if (BagSystem.instance.GetItemMaxNum((uint)drawNeedItem_) >= drawNeedBlueNum_)
            {
                MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("xiaohaojizhnag").Replace("{n1}", drawNeedBlueNum_.ToString()).Replace("{n}", ItemData.GetData(drawNeedItem_).name_), () => {
                    NetConnection.Instance.drawLotteryBox(btpye, false);
                    LotteryBtn.isEnabled = false;
                    SetPrizeWinDisplay(false);
                });
            }
            else if (GamePlayer.Instance.GetIprop(PropertyType.PT_Diamond) >= drawNeedBlueZhuanNum_)
            {
                MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("chouxiaohanzs").Replace("{n}", drawNeedBlueZhuanNum_.ToString()), () => {
                    NetConnection.Instance.drawLotteryBox(BoxType.BX_Blue, false);
                    LotteryBtn.isEnabled = false;
                    SetPrizeWinDisplay(false);
                });
            }
            else if (GamePlayer.Instance.GetIprop(PropertyType.PT_MagicCurrency) >= drawNeedBlueZhuanNum_)
            {
                MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("xiaohaotimoli").Replace("{n}", drawNeedBlueZhuanNum_.ToString()), () => {
                    NetConnection.Instance.drawLotteryBox(BoxType.BX_Blue, false);
                    LotteryBtn.isEnabled = false;
                    SetPrizeWinDisplay(false);
                });
            }
            else
            {
                MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("daojubuzu"), () => { StoreUI.SwithShowMe(2); });
            }
            showBuyBtn(true);
        }
        else if (btpye == BoxType.BX_Normal)
        {
            if (GamePlayer.Instance.GetIprop(PropertyType.PT_Money) < _BoxGreenSpend)
            {
                MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("nomoney"), () => {});
                showBuyBtn(true);
                return;
            }

            MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("chouxiaohanjq").Replace("{n}", _BoxGreenSpend.ToString()), () => {
                NetConnection.Instance.drawLotteryBox(btpye, false);
                LotteryBtn.isEnabled = false;
                SetPrizeWinDisplay(false);
            });

            showBuyBtn(true);
        }
    }
Exemple #9
0
    void OnClicketermine(ButtonScript obj, object args, int param1, int param2)
    {
        //if(GamePlayer.Instance.GetIprop(PropertyType.PT_BagNum) <= BagSystem.instance.GetBagSize())
        //{
        //ErrorTipsUI.ShowMe(LanguageManager.instance.GetValue("bagfull"));
        //PopText.Instance.Show(LanguageManager.instance.GetValue("bagfull"));
        //return;
        //}
        string type = "";

        if (spData_._ShopPayType == ShopPayType.SPT_Diamond)
        {
            type = LanguageManager.instance.GetValue("zuanshi");
        }
        else if (spData_._ShopPayType == ShopPayType.SPT_Gold)
        {
            type = LanguageManager.instance.GetValue("jinbi");
        }
        else if (spData_._ShopPayType == ShopPayType.SPT_MagicCurrency)
        {
            type = LanguageManager.instance.GetValue("shuijing");
        }



        if (IsBalanceInadequate(SpData, count) == 1)
        {
            if (GamePlayer.Instance.GetIprop(PropertyType.PT_MagicCurrency) >= (count * SpData._Price))
            {
                MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("xiaohaotimoli").Replace("{n}", (count * SpData._Price).ToString()), () => {
                    NetConnection.Instance.shopBuyItem(SpData._Id, count);
                    gameObject.SetActive(false);
                });
            }
            else
            {
                PopText.Instance.Show(LanguageManager.instance.GetValue("zuanshibuzu"));
            }
        }
        else if (IsBalanceInadequate(SpData, count) == 2)
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("jinbibuzu"));
        }
        else if (IsBalanceInadequate(SpData, count) == 3)
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("noshuijing"));
        }
        else if (IsReachedNumber())
        {
            PopText.Instance.Show(LanguageManager.instance.GetValue("goumaicishu"));
        }
        else
        {
            MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("shopbuyitem").Replace("{n}", (count).ToString()).Replace("{n1}", SpData._Name).Replace("{n2}", (count * SpData._Price).ToString() + type), () => {
                NetConnection.Instance.shopBuyItem(SpData._Id, count);
                if (type.Equals(LanguageManager.instance.GetValue("zuanshi")))
                {
                    CommonEvent.ExcutePurchase(spData_._Itemid, count, spData_._Price);
                }

                gameObject.SetActive(false);
            });
        }
    }
Exemple #10
0
 private void OnResetBtn(ButtonScript obj, object args, int param1, int param2)
 {
     MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("shifouchongzhi"), () => {
         NetConnection.Instance.resetHundredTier();
     });
 }
Exemple #11
0
    void OnClicketermine(ButtonScript obj, object args, int param1, int param2)
    {
        if (GamePlayer.Instance.GetIprop(PropertyType.PT_BagNum) <= BagSystem.instance.GetBagSize())
        {
            //ErrorTipsUI.ShowMe(LanguageManager.instance.GetValue("bagfull"));
            PopText.Instance.Show(LanguageManager.instance.GetValue("bagfull"));
            return;
        }
        string type = "";

        if (spData_._ShopPayType == ShopPayType.SPT_Diamond)
        {
            type = LanguageManager.instance.GetValue("zuanshi");
        }
        else if (spData_._ShopPayType == ShopPayType.SPT_Gold)
        {
            type = LanguageManager.instance.GetValue("jinbi");
        }
        else if (spData_._ShopPayType == ShopPayType.SPT_MagicCurrency)
        {
            type = LanguageManager.instance.GetValue("shuijing");
        }
        count = int.Parse(input.value);


        MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("shopbuyitem").Replace("{n}", (count * SpData._Num).ToString()).Replace("{n1}", SpData._Name).Replace("{n2}", (count * SpData._Price).ToString() + type), () => {
            if (IsBalanceInadequate(SpData) == 1)
            {
                if (GamePlayer.Instance.Properties[(int)PropertyType.PT_MagicCurrency] < SpData._Price)
                {
                    PopText.Instance.Show(LanguageManager.instance.GetValue("zuanshibuzu"));
                }
                else
                {
                    MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("xiaohaotimoli").Replace("{n}", SpData._Price.ToString()), delegate
                    {
                        NetConnection.Instance.shopBuyItem(SpData._Id, count);
                        if (buyCallback_ != null)
                        {
                            buyCallback_();
                        }
                    });
                }
            }
            else
            if (IsBalanceInadequate(SpData) == 2)
            {
                PopText.Instance.Show(LanguageManager.instance.GetValue("jinbibuzu"));
            }
            else if (IsBalanceInadequate(SpData) == 3)
            {
                PopText.Instance.Show(LanguageManager.instance.GetValue("noshuijing"));
            }
            else if (IsReachedNumber())
            {
                PopText.Instance.Show(LanguageManager.instance.GetValue("nodiamond"));
            }
            else
            {
                NetConnection.Instance.shopBuyItem(SpData._Id, count);
//				SpData.Num_--;
//				if(SpData.Num_<=0)SpData.Num_ = 0;

                if (buyCallback_ != null)
                {
                    buyCallback_();
                }
            }

            Hide();
        });
    }
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (decimal.Parse(lblTotalPOQty.Text) == 0)
                {
                    MessageBoxUI _mb1 = new MessageBoxUI("Totals of P.O. Qty must not be Zero(0)!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb1.showDialog();
                    return;
                }
                string _SupplierId = "";
                string _Employee   = "";
                try
                {
                    _SupplierId = cboSupplier.SelectedValue.ToString();
                }
                catch
                {
                    MessageBoxUI _mb1 = new MessageBoxUI("You must select a Supplier!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb1.showDialog();
                    cboSupplier.Focus();
                    return;
                }
                try
                {
                    _Employee = cboRequestedBy.SelectedValue.ToString();
                }
                catch
                {
                    _Employee = "";
                }
                DialogResult _dr = new DialogResult();
                MessageBoxUI _mb = new MessageBoxUI("Continue saving this Purchase Order?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo);
                _mb.ShowDialog();
                _dr = _mb.Operation;
                if (_dr == DialogResult.Yes)
                {
                    loPurchaseOrder.Id   = lPurchaseOrderId;
                    loPurchaseOrder.Date = dtpDate.Value;
                    try
                    {
                        loPurchaseOrder.PRId = cboPurchaseRequest.SelectedValue.ToString();
                    }
                    catch
                    {
                        loPurchaseOrder.PRId = "";
                    }

                    loPurchaseOrder.Reference  = GlobalFunctions.replaceChar(txtReference.Text);
                    loPurchaseOrder.SupplierId = _SupplierId;
                    try
                    {
                        loPurchaseOrder.Terms = int.Parse(txtTerms.Text);
                    }
                    catch
                    {
                        loPurchaseOrder.Terms = 0;
                    }
                    loPurchaseOrder.DueDate          = dtpDueDate.Value;
                    loPurchaseOrder.Instructions     = GlobalFunctions.replaceChar(txtInstructions.Text);
                    loPurchaseOrder.RequestedBy      = _Employee;
                    loPurchaseOrder.DateNeeded       = dtpDateNeeded.Value;
                    loPurchaseOrder.TotalPOQty       = decimal.Parse(lblTotalPOQty.Text);
                    loPurchaseOrder.TotalQtyIn       = decimal.Parse(lblTotalQtyIn.Text);
                    loPurchaseOrder.TotalQtyVariance = decimal.Parse(lblTotalQtyVariance.Text);
                    loPurchaseOrder.TotalAmount      = decimal.Parse(txtTotalAmount.Text);
                    loPurchaseOrder.Remarks          = GlobalFunctions.replaceChar(txtRemarks.Text);
                    loPurchaseOrder.UserId           = GlobalVariables.UserId;

                    string _PurchaseOrderId = loPurchaseOrder.save(lOperation);
                    if (_PurchaseOrderId != "")
                    {
                        for (int i = 0; i < dgvDetailStockInventory.Rows.Count; i++)
                        {
                            if (dgvDetailStockInventory.Rows[i].Cells["Status"].Value.ToString() == "Add")
                            {
                                try
                                {
                                    loPurchaseOrderDetail.DetailId = dgvDetailStockInventory.Rows[i].Cells["Id"].Value.ToString();
                                }
                                catch
                                {
                                    loPurchaseOrderDetail.DetailId = "";
                                }
                                try
                                {
                                    loPurchaseOrderDetail.PurchaseOrderId = _PurchaseOrderId;
                                    loPurchaseOrderDetail.StockId         = dgvDetailStockInventory.Rows[i].Cells["StockId"].Value.ToString();
                                    loPurchaseOrderDetail.LocationId      = dgvDetailStockInventory.Rows[i].Cells["LocationId"].Value.ToString();
                                    loPurchaseOrderDetail.POQty           = decimal.Parse(dgvDetailStockInventory.Rows[i].Cells["POQty"].Value.ToString());
                                    loPurchaseOrderDetail.QtyIn           = decimal.Parse(dgvDetailStockInventory.Rows[i].Cells["QtyIn"].Value.ToString());
                                    loPurchaseOrderDetail.QtyVariance     = decimal.Parse(dgvDetailStockInventory.Rows[i].Cells["QtyVariance"].Value.ToString());
                                    loPurchaseOrderDetail.UnitPrice       = decimal.Parse(dgvDetailStockInventory.Rows[i].Cells["UnitPrice"].Value.ToString());
                                    loPurchaseOrderDetail.DiscountId      = dgvDetailStockInventory.Rows[i].Cells["DiscountId"].Value.ToString();
                                    loPurchaseOrderDetail.DiscountAmount  = decimal.Parse(dgvDetailStockInventory.Rows[i].Cells["DiscountAmount"].Value.ToString());
                                    loPurchaseOrderDetail.TotalPrice      = decimal.Parse(dgvDetailStockInventory.Rows[i].Cells["TotalPrice"].Value.ToString());
                                    loPurchaseOrderDetail.Remarks         = dgvDetailStockInventory.Rows[i].Cells["Remarks"].Value.ToString();
                                    loPurchaseOrderDetail.UserId          = GlobalVariables.UserId;
                                    loPurchaseOrderDetail.save(GlobalVariables.Operation.Add);
                                }
                                catch { }
                            }
                            else if (dgvDetailStockInventory.Rows[i].Cells["Status"].Value.ToString() == "Edit")
                            {
                                try
                                {
                                    loPurchaseOrderDetail.DetailId = dgvDetailStockInventory.Rows[i].Cells["Id"].Value.ToString();
                                }
                                catch
                                {
                                    loPurchaseOrderDetail.DetailId = "";
                                }
                                loPurchaseOrderDetail.PurchaseOrderId = _PurchaseOrderId;
                                loPurchaseOrderDetail.StockId         = dgvDetailStockInventory.Rows[i].Cells["StockId"].Value.ToString();
                                loPurchaseOrderDetail.LocationId      = dgvDetailStockInventory.Rows[i].Cells["LocationId"].Value.ToString();
                                loPurchaseOrderDetail.POQty           = decimal.Parse(dgvDetailStockInventory.Rows[i].Cells["POQty"].Value.ToString());
                                loPurchaseOrderDetail.QtyIn           = decimal.Parse(dgvDetailStockInventory.Rows[i].Cells["QtyIn"].Value.ToString());
                                loPurchaseOrderDetail.QtyVariance     = decimal.Parse(dgvDetailStockInventory.Rows[i].Cells["QtyVariance"].Value.ToString());
                                loPurchaseOrderDetail.UnitPrice       = decimal.Parse(dgvDetailStockInventory.Rows[i].Cells["UnitPrice"].Value.ToString());
                                loPurchaseOrderDetail.DiscountId      = dgvDetailStockInventory.Rows[i].Cells["DiscountId"].Value.ToString();
                                loPurchaseOrderDetail.DiscountAmount  = decimal.Parse(dgvDetailStockInventory.Rows[i].Cells["DiscountAmount"].Value.ToString());
                                loPurchaseOrderDetail.TotalPrice      = decimal.Parse(dgvDetailStockInventory.Rows[i].Cells["TotalPrice"].Value.ToString());
                                loPurchaseOrderDetail.Remarks         = dgvDetailStockInventory.Rows[i].Cells["Remarks"].Value.ToString();
                                loPurchaseOrderDetail.UserId          = GlobalVariables.UserId;
                                loPurchaseOrderDetail.save(GlobalVariables.Operation.Edit);
                            }
                            else if (dgvDetailStockInventory.Rows[i].Cells["Status"].Value.ToString() == "Delete")
                            {
                                loPurchaseOrderDetail.remove(dgvDetailStockInventory.Rows[i].Cells[0].Value.ToString());
                            }
                        }
                        if (txtId.Text == _PurchaseOrderId)
                        {
                            MessageBoxUI _mb2 = new MessageBoxUI("Purchase Order has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK);
                            _mb2.showDialog();
                        }
                        else
                        {
                            MessageBoxUI _mb2 = new MessageBoxUI("Purchase Order has been saved successfully! New Purchase Order ID. : " + _PurchaseOrderId, GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK);
                            _mb2.showDialog();
                        }

                        //previewDetail(_PurchaseOrderId);

                        object[] _params = { };
                        ParentList.GetType().GetMethod("refresh").Invoke(ParentList, _params);
                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click");
                em.ShowDialog();
                return;
            }
        }
Exemple #13
0
        private void refresh()
        {
            try
            {
                DataTable _dtPayable = loPurchaseOrder.getAccountPayables();
                if (_dtPayable.Rows.Count > 0)
                {
                    loAccountPayableRpt.SetDataSource(GlobalVariables.DTCompanyLogo);
                    loAccountPayableRpt.Database.Tables[1].SetDataSource(_dtPayable);
                    loAccountPayableRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName);
                    loAccountPayableRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress);
                    loAccountPayableRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber);
                    loAccountPayableRpt.SetParameterValue("Username", GlobalVariables.Userfullname);
                    loAccountPayableRpt.SetParameterValue("Title", "All Payables");
                    loAccountPayableRpt.SetParameterValue("SubTitle", "All Payables");
                    crvAllPaybleAccounts.ReportSource = loAccountPayableRpt;
                }
                else
                {
                    MessageBoxUI _mb = new MessageBoxUI("No records found!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            try
            {
                DataTable _dtDueDate = loPurchaseOrder.getAccountPayables();
                if (_dtDueDate.Rows.Count > 0)
                {
                    loAccountPayableByDueDateRpt.SetDataSource(GlobalVariables.DTCompanyLogo);
                    loAccountPayableByDueDateRpt.Database.Tables[1].SetDataSource(_dtDueDate);
                    loAccountPayableByDueDateRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName);
                    loAccountPayableByDueDateRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress);
                    loAccountPayableByDueDateRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber);
                    loAccountPayableByDueDateRpt.SetParameterValue("Username", GlobalVariables.Userfullname);
                    loAccountPayableByDueDateRpt.SetParameterValue("Title", "Payables by Due Date");
                    loAccountPayableByDueDateRpt.SetParameterValue("SubTitle", "Payables by Due Date");
                    crvPayablesByDueDate.ReportSource = loAccountPayableByDueDateRpt;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            try
            {
                DataTable _dtOverDueAccounts = loPurchaseOrder.getAccountPayablesOverdue();
                if (_dtOverDueAccounts.Rows.Count > 0)
                {
                    loOverDueAccountsRpt.SetDataSource(GlobalVariables.DTCompanyLogo);
                    loOverDueAccountsRpt.Database.Tables[1].SetDataSource(_dtOverDueAccounts);
                    loOverDueAccountsRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName);
                    loOverDueAccountsRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress);
                    loOverDueAccountsRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber);
                    loOverDueAccountsRpt.SetParameterValue("Username", GlobalVariables.Userfullname);
                    loOverDueAccountsRpt.SetParameterValue("Title", "Overdue Payables");
                    loOverDueAccountsRpt.SetParameterValue("SubTitle", "Overdue Payables");
                    crvOverdueAccounts.ReportSource = loOverDueAccountsRpt;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void btnClose_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsmFinancialYearClosing", "Close"))
                {
                    return;
                }

                DialogResult _dr  = new DialogResult();
                MessageBoxUI _mb1 = new MessageBoxUI("Are sure you want to continue closing the Financial Year?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo);
                _mb1.ShowDialog();
                _dr = _mb1.Operation;
                if (_dr == DialogResult.Yes)
                {
                    //closing entry
                    try
                    {
                        loJournalEntry.JournalEntryId = "";
                        loJournalEntry.FinancialYear  = int.Parse(txtFinancialYear.Text);
                        loJournalEntry.Journal        = "GJ";
                        loJournalEntry.Form           = "JV";
                        loJournalEntry.VoucherNo      = "";
                        loJournalEntry.DatePrepared   = dtpDate.Value;
                        loJournalEntry.Explanation    = "System : Closing Entry";
                        loJournalEntry.TotalDebit     = decimal.Parse(txtTotalDebit.Text);
                        loJournalEntry.TotalCredit    = decimal.Parse(txtTotalCredit.Text);
                        loJournalEntry.Reference      = "";
                        loJournalEntry.SupplierId     = "";
                        loJournalEntry.CustomerId     = "";
                        loJournalEntry.BegBal         = "N";
                        loJournalEntry.Adjustment     = "N";
                        loJournalEntry.ClosingEntry   = "Y";
                        loJournalEntry.PreparedBy     = GlobalVariables.Username;
                        loJournalEntry.Remarks        = "";
                        loJournalEntry.SOId           = "0";
                        loJournalEntry.POId           = "0";
                        loJournalEntry.UserId         = GlobalVariables.UserId;

                        try
                        {
                            string _JournalEntryId = loJournalEntry.save(GlobalVariables.Operation.Add);
                            if (_JournalEntryId != "")
                            {
                                //income
                                for (int i = 0; i < dgvIncomeEntry.Rows.Count; i++)
                                {
                                    loJournalEntryDetail.DetailId              = "";
                                    loJournalEntryDetail.JournalEntryId        = _JournalEntryId;
                                    loJournalEntryDetail.AccountId             = dgvIncomeEntry.Rows[i].Cells["IncomeAccountId"].Value.ToString();
                                    loJournalEntryDetail.Debit                 = decimal.Parse(dgvIncomeEntry.Rows[i].Cells["IncomeDebit"].Value.ToString());
                                    loJournalEntryDetail.Credit                = decimal.Parse(dgvIncomeEntry.Rows[i].Cells["IncomeCredit"].Value.ToString());
                                    loJournalEntryDetail.Subsidiary            = "";
                                    loJournalEntryDetail.SubsidiaryId          = "";
                                    loJournalEntryDetail.SubsidiaryDescription = "";
                                    loJournalEntryDetail.Remarks               = "";
                                    loJournalEntryDetail.UserId                = GlobalVariables.UserId;
                                    loJournalEntryDetail.save(GlobalVariables.Operation.Add);
                                }
                                //expense
                                for (int i = 0; i < dgvExpenseEntry.Rows.Count; i++)
                                {
                                    loJournalEntryDetail.DetailId              = "";
                                    loJournalEntryDetail.JournalEntryId        = _JournalEntryId;
                                    loJournalEntryDetail.AccountId             = dgvExpenseEntry.Rows[i].Cells["ExpenseAccountId"].Value.ToString();
                                    loJournalEntryDetail.Debit                 = decimal.Parse(dgvExpenseEntry.Rows[i].Cells["ExpenseDebit"].Value.ToString());
                                    loJournalEntryDetail.Credit                = decimal.Parse(dgvExpenseEntry.Rows[i].Cells["ExpenseCredit"].Value.ToString());
                                    loJournalEntryDetail.Subsidiary            = "";
                                    loJournalEntryDetail.SubsidiaryId          = "";
                                    loJournalEntryDetail.SubsidiaryDescription = "";
                                    loJournalEntryDetail.Remarks               = "";
                                    loJournalEntryDetail.UserId                = GlobalVariables.UserId;
                                    loJournalEntryDetail.save(GlobalVariables.Operation.Add);
                                }
                                //retained earning
                                for (int i = 0; i < dgvRetainedEarningEntry.Rows.Count; i++)
                                {
                                    loJournalEntryDetail.DetailId              = "";
                                    loJournalEntryDetail.JournalEntryId        = _JournalEntryId;
                                    loJournalEntryDetail.AccountId             = dgvRetainedEarningEntry.Rows[i].Cells["REAccountId"].Value.ToString();
                                    loJournalEntryDetail.Debit                 = decimal.Parse(dgvRetainedEarningEntry.Rows[i].Cells["REDebit"].Value.ToString());
                                    loJournalEntryDetail.Credit                = decimal.Parse(dgvRetainedEarningEntry.Rows[i].Cells["RECredit"].Value.ToString());
                                    loJournalEntryDetail.Subsidiary            = "";
                                    loJournalEntryDetail.SubsidiaryId          = "";
                                    loJournalEntryDetail.SubsidiaryDescription = "";
                                    loJournalEntryDetail.Remarks               = "";
                                    loJournalEntryDetail.UserId                = GlobalVariables.UserId;
                                    loJournalEntryDetail.save(GlobalVariables.Operation.Add);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }

                        //loJournalEntry.closeFinancialYear(int.Parse(txtFinancialYear.Text)+1);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }

                    MessageBoxUI _mb2 = new MessageBoxUI("Financial Year : " + txtFinancialYear.Text + " has been successfully closed!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK);
                    _mb2.ShowDialog();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnClose_Click");
                em.ShowDialog();
                return;
            }
        }
Exemple #15
0
        private void btnCancel_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsmSalesOrder", "Cancel"))
                {
                    return;
                }

                foreach (DataRow _drStatus in loSalesOrder.getSalesOrderStatus(dgvList.CurrentRow.Cells[0].Value.ToString()).Rows)
                {
                    if (_drStatus["Final"].ToString() == "N")
                    {
                        MessageBoxUI _mbStatus = new MessageBoxUI("Sales Order must be FINALIZED to be cancelled!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                        _mbStatus.ShowDialog();
                        return;
                    }
                    if (_drStatus["Cancel"].ToString() == "Y")
                    {
                        MessageBoxUI _mbStatus = new MessageBoxUI("Sales Order is already cancelled!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                        _mbStatus.ShowDialog();
                        return;
                    }
                    if (_drStatus["Post"].ToString() == "Y")
                    {
                        MessageBoxUI _mbStatus = new MessageBoxUI("You cannot cancel a POSTED Sales Order!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                        _mbStatus.ShowDialog();
                        return;
                    }

                    /*
                     * if (_drStatus[1].ToString() == GlobalVariables.Username || _drStatus[4].ToString() == GlobalVariables.Username)
                     * {
                     *  MessageBoxUI _mbStatus = new MessageBoxUI("You cannot CANCEL a Sales Order you preprared/finalized!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                     *  _mbStatus.ShowDialog();
                     *  return;
                     * }
                     */
                }
                if (dgvList.Rows.Count > 0)
                {
                    DialogResult _dr = new DialogResult();
                    MessageBoxUI _mb = new MessageBoxUI("Are sure you want to continue cancelling this Sales Order record?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo);
                    _mb.ShowDialog();
                    _dr = _mb.Operation;
                    if (_dr == DialogResult.Yes)
                    {
                        SalesCancelReasonUI loSalesCancelReason = new SalesCancelReasonUI();
                        loSalesCancelReason.ShowDialog();
                        if (loSalesCancelReason.lReason == "")
                        {
                            MessageBoxUI _mb1 = new MessageBoxUI("You must have a reason in cancelling entry!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                            _mb1.ShowDialog();
                            return;
                        }
                        else
                        {
                            if (loSalesOrder.cancel(dgvList.CurrentRow.Cells[0].Value.ToString(), loSalesCancelReason.lReason))
                            {
                                foreach (DataRow _drSO in loJournalEntry.getJournalEntryBySOId(dgvList.CurrentRow.Cells[0].Value.ToString()).Rows)
                                {
                                    loJournalEntry.cancel(_drSO[0].ToString(), loSalesCancelReason.lReason);
                                }

                                MessageBoxUI _mb1 = new MessageBoxUI("Sales Order record has been successfully cancelled!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK);
                                _mb1.ShowDialog();
                                refresh();
                            }
                            else
                            {
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnCancel_Click");
                em.ShowDialog();
                return;
            }
        }
Exemple #16
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                char[] splitter = { '_' };
                foreach (Control ctrl in this.pnlBody.Controls)
                {
                    if (ctrl is TextBox && (ctrl.Name.Contains("Code") || ctrl.Name.Contains("Id")) && ctrl.Text == "")
                    {
                        MessageBoxUI mb = new MessageBoxUI(ctrl.Name + " must have a value!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                        mb.ShowDialog();
                        ctrl.Focus();
                        return;
                    }
                    else if (ctrl is TextBox)
                    {
                        string namestr = ctrl.Name.ToString().Replace(" ", "");
                        string textstr = ctrl.Text.ToString();
                        lObjectArgHash.Add(namestr, textstr);
                    }
                    else if (ctrl is CheckBox)
                    {
                        string   namestr = ctrl.Name.ToString().Replace(" ", "");
                        CheckBox chk     = ctrl as CheckBox;
                        if (chk.Checked)
                        {
                            lObjectArgHash.Add(namestr, "Y");
                        }
                        else
                        {
                            lObjectArgHash.Add(namestr, "N");
                        }
                    }
                    else if (ctrl is Label)
                    {
                        if (ctrl.Name == " Color")
                        {
                            string namestr = ctrl.Name.ToString().Replace(" ", "");
                            string textstr = ctrl.Text.ToString();
                            lObjectArgHash.Add(namestr, textstr);
                        }
                    }
                }
                if (!lFromAdd)
                {
                    lObjectArgHash["Operation"] = "Edit";
                }
                else
                {
                    lObjectArgHash["Operation"] = "Add";
                }
                lObjectArg    = new object[1];
                lObjectArg[0] = lObjectArgHash;
            }
            catch (Exception ex)
            {
                this.Show();
                MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                mb.ShowDialog();
                return;
            }
            MySqlTransaction Trans = GlobalVariables.Connection.BeginTransaction();

            object[] param = { lObjectArgHash, Trans };

            try
            {
                if ((bool)lObject.GetType().GetMethod("save").Invoke(lObject, param))
                {
                    Trans.Commit();
                    this.Hide();
                    MessageBoxUI _mb = new MessageBoxUI(lClassName + " has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    try
                    {
                        object[] _params = { "ViewAll", "" };
                        ParentList.GetType().GetMethod("refresh").Invoke(ParentList, _params);
                    }
                    catch { }
                    this.Close();
                }
                else
                {
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                Trans.Rollback();
                this.Show();
                MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                mb.ShowDialog();
                return;
            }
        }
Exemple #17
0
        private void btnPost_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsmSalesOrder", "Post"))
                {
                    return;
                }

                foreach (DataRow _drStatus in loSalesOrder.getSalesOrderStatus(dgvList.CurrentRow.Cells[0].Value.ToString()).Rows)
                {
                    if (_drStatus["Final"].ToString() == "N")
                    {
                        MessageBoxUI _mbStatus = new MessageBoxUI("Sales Order must be FINALIZED!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                        _mbStatus.ShowDialog();
                        return;
                    }
                    else if (_drStatus["Cancel"].ToString() == "Y")
                    {
                        MessageBoxUI _mbStatus = new MessageBoxUI("You cannot post a CANCELLED Sales Order!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                        _mbStatus.ShowDialog();
                        return;
                    }
                    else if (_drStatus["Post"].ToString() == "Y")
                    {
                        MessageBoxUI _mbStatus = new MessageBoxUI("Sales Order is already POSTED!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                        _mbStatus.ShowDialog();
                        return;
                    }
                    else if (decimal.Parse(_drStatus["TotalQtyOut"].ToString()) <= 0)
                    {
                        MessageBoxUI _mbStatus = new MessageBoxUI("Total Qty OUT must be greater than or equal to zero(0)!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                        _mbStatus.ShowDialog();
                        return;
                    }

                    /*
                     * if (_drStatus[4].ToString() == GlobalVariables.Username)
                     * {
                     *  MessageBoxUI _mbStatus = new MessageBoxUI("You cannot FINALIZE a Sales Order you preprared!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                     *  _mbStatus.ShowDialog();
                     *  return;
                     * }
                     */
                    /*
                     * if (_drStatus["SWId"].ToString() == "")
                     * {
                     *  MessageBoxUI _mbStatus = new MessageBoxUI("Stocks Withdrawal must precedes finalization!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                     *  _mbStatus.ShowDialog();
                     *  return;
                     * }
                     */
                }

                if (dgvList.Rows.Count > 0)
                {
                    DialogResult _dr = new DialogResult();
                    MessageBoxUI _mb = new MessageBoxUI("Are sure you want to continue posting this Sales Order record?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo);
                    _mb.ShowDialog();
                    _dr = _mb.Operation;
                    if (_dr == DialogResult.Yes)
                    {
                        if (loSalesOrder.post(dgvList.CurrentRow.Cells[0].Value.ToString()))
                        {
                            foreach (DataRow _drSO in loSalesOrder.getAllData("", dgvList.CurrentRow.Cells[0].Value.ToString(), "").Rows)
                            {
                                insertJournalEntry(dgvList.CurrentRow.Cells[0].Value.ToString(), decimal.Parse(_drSO["Total Amount"].ToString()),
                                                   _drSO["CustomerId"].ToString(), _drSO["Customer"].ToString(), "Sales from Sales Order (SOId:" + _drSO["Id"].ToString() + ").");
                            }

                            MessageBoxUI _mb1 = new MessageBoxUI("Sales Order record has been successfully posted!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK);
                            _mb1.ShowDialog();
                            //previewSalesOrderDetail(dgvList.CurrentRow.Cells[0].Value.ToString());
                            //sendEmailToCreator();
                            refresh();
                        }
                        else
                        {
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnPost_Click");
                em.ShowDialog();
                return;
            }
        }
Exemple #18
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            loStock.Id          = lId;
            loStock.Description = GlobalFunctions.replaceChar(txtDescription.Text);
            try
            {
                loStock.CategoryId = cboCategory.SelectedValue.ToString();
            }
            catch
            {
                loStock.CategoryId = "";

                /*
                 * MessageBoxUI _mb = new MessageBoxUI("You must select a correct Category!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                 * _mb.showDialog();
                 * cboCategory.Focus();
                 * return;
                 */
            }
            try
            {
                loStock.UnitId = cboUnit.SelectedValue.ToString();
            }
            catch
            {
                loStock.UnitId = "";

                /*
                 * MessageBoxUI _mb = new MessageBoxUI("You must select a correct Unit!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                 * _mb.showDialog();
                 * cboUnit.Focus();
                 * return;
                 */
            }
            try
            {
                loStock.BrandId = cboBrand.SelectedValue.ToString();
            }
            catch
            {
                loStock.BrandId = "";
            }
            try
            {
                loStock.SupplierId = cboSupplier.SelectedValue.ToString();
            }
            catch
            {
                loStock.SupplierId = "";
            }
            loStock.Picture      = lPicture;
            loStock.UnitCost     = decimal.Parse(txtUnitCost.Text);
            loStock.UnitPrice    = decimal.Parse(txtUnitPrice.Text);
            loStock.ReorderLevel = decimal.Parse(txtReorderLevel.Text);
            loStock.Remarks      = GlobalFunctions.replaceChar(txtRemarks.Text);

            MySqlTransaction _Trans = GlobalVariables.Connection.BeginTransaction();

            try
            {
                string _StockId = loStock.save(lOperation, ref _Trans);
                if (_StockId != "")
                {
                    _Trans.Commit();
                    MessageBoxUI _mb = new MessageBoxUI("Stock has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    lRecords[0]  = _StockId;
                    lRecords[1]  = txtDescription.Text;
                    lRecords[2]  = cboCategory.Text;
                    lRecords[3]  = cboUnit.Text;
                    lRecords[4]  = cboBrand.Text;
                    lRecords[5]  = cboSupplier.Text;
                    lRecords[6]  = lPicture;
                    lRecords[7]  = decimal.Parse(txtUnitCost.Text).ToString();
                    lRecords[8]  = decimal.Parse(txtUnitPrice.Text).ToString();
                    lRecords[9]  = decimal.Parse(txtReorderLevel.Text).ToString();
                    lRecords[10] = txtRemarks.Text;

                    object[] _params = { lRecords };
                    if (lOperation == GlobalVariables.Operation.Edit)
                    {
                        try
                        {
                            ParentList.GetType().GetMethod("updateData").Invoke(ParentList, _params);
                        }
                        catch { }
                        this.Close();
                    }
                    else
                    {
                        ParentList.GetType().GetMethod("addData").Invoke(ParentList, _params);
                        clear();
                        //this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                _Trans.Rollback();
                if (ex.Message.Contains("Duplicate"))
                {
                    MessageBoxUI _mb = new MessageBoxUI("Stock Id already exist!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    return;
                }
            }
        }
Exemple #19
0
 void OnClickabnegate(ButtonScript obj, object args, int param1, int param2)
 {
     MessageBoxUI.ShowMe(LanguageManager.instance.GetValue("fangqiQuest"), () => {
         NetConnection.Instance.giveupQuest(CurrentId);
     });
 }
        private void btnCancel_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsmPurchaseRequest", "Cancel"))
                {
                    return;
                }

                foreach (DataRow _drStatus in loPurchaseRequest.getPurchaseRequestStatus(dgvList.CurrentRow.Cells[0].Value.ToString()).Rows)
                {
                    if (_drStatus[0].ToString() == "N")
                    {
                        MessageBoxUI _mbStatus = new MessageBoxUI("Purchase Request must be APPROVED to be cancelled!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                        _mbStatus.ShowDialog();
                        return;
                    }
                    if (_drStatus[2].ToString() == "Y")
                    {
                        MessageBoxUI _mbStatus = new MessageBoxUI("Purchase Request is already cancelled!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                        _mbStatus.ShowDialog();
                        return;
                    }
                    if (_drStatus["POId"].ToString() != "")
                    {
                        MessageBoxUI _mbStatus = new MessageBoxUI("You cannot cancel a Purchase Request with P.O. Id!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                        _mbStatus.ShowDialog();
                        return;
                    }

                    /*
                     * if (_drStatus[1].ToString() == GlobalVariables.Username || _drStatus[4].ToString() == GlobalVariables.Username)
                     * {
                     *  MessageBoxUI _mbStatus = new MessageBoxUI("You cannot CANCEL a Purchase Request you preprared/approved!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                     *  _mbStatus.ShowDialog();
                     *  return;
                     * }
                     */
                }
                if (dgvList.Rows.Count > 0)
                {
                    DialogResult _dr = new DialogResult();
                    MessageBoxUI _mb = new MessageBoxUI("Are sure you want to continue cancelling this Purchase Request record?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo);
                    _mb.ShowDialog();
                    _dr = _mb.Operation;
                    if (_dr == DialogResult.Yes)
                    {
                        ProcurementCancelReasonUI loProcurementCancelReason = new ProcurementCancelReasonUI();
                        loProcurementCancelReason.ShowDialog();
                        if (loProcurementCancelReason.lReason == "")
                        {
                            MessageBoxUI _mb1 = new MessageBoxUI("You must have a reason in cancelling entry!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                            _mb1.ShowDialog();
                            return;
                        }
                        else
                        {
                            if (loPurchaseRequest.cancel(dgvList.CurrentRow.Cells[0].Value.ToString(), loProcurementCancelReason.lReason))
                            {
                                MessageBoxUI _mb1 = new MessageBoxUI("Purchase Request record has been successfully cancelled!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK);
                                _mb1.ShowDialog();
                                refresh();
                            }
                            else
                            {
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnCancel_Click");
                em.ShowDialog();
                return;
            }
        }
        private void btnFinalize_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsmStockWithdrawal", "Finalize"))
                {
                    return;
                }

                string _SOId = "";

                foreach (DataRow _drStatus in loInventory.getInventoryStatus(dgvList.CurrentRow.Cells[0].Value.ToString()).Rows)
                {
                    _SOId = _drStatus["SOId"].ToString();

                    if (_drStatus["Final"].ToString() == "Y")
                    {
                        MessageBoxUI _mbStatus = new MessageBoxUI("Stock Inventory is already FINALIZED!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                        _mbStatus.ShowDialog();
                        return;
                    }
                }
                if (dgvList.Rows.Count > 0)
                {
                    DialogResult _dr = new DialogResult();
                    MessageBoxUI _mb = new MessageBoxUI("Are sure you want to continue finalizing this Stock Inventory record?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo);
                    _mb.ShowDialog();
                    _dr = _mb.Operation;
                    if (_dr == DialogResult.Yes)
                    {
                        if (loInventory.final(dgvList.CurrentRow.Cells[0].Value.ToString()))
                        {
                            //update SO Detail
                            foreach (DataRow _dr1 in loInventoryDetail.getInventoryDetails("", dgvList.CurrentRow.Cells[0].Value.ToString()).Rows)
                            {
                                //update Qty
                                loSalesOrderDetail.updateQtyOutSalesOrderDetail(_dr1["SODetailId"].ToString(), decimal.Parse(_dr1["Qty Out"].ToString()), decimal.Parse(_dr1["Variance"].ToString()));
                                //updtae TotalPrice
                                decimal _totalPrice = 0;
                                foreach (DataRow _dr2 in loSalesOrderDetail.getSalesOrderDetail(_dr1["SODetailId"].ToString()).Rows)
                                {
                                    _totalPrice = decimal.Parse(_dr2["Qty Out"].ToString()) * decimal.Parse(_dr2["Unit Price"].ToString());
                                    loSalesOrderDetail.updateTotalPriceSalesOrderDetail(_dr1["SODetailId"].ToString(), _totalPrice);
                                }
                            }
                            //update PO Header Qty and Amount
                            decimal _totalQtyOut   = 0;
                            decimal _totalVariance = 0;
                            decimal _totalAmount   = 0;
                            foreach (DataRow _dr3 in loSalesOrderDetail.getSalesOrderDetails("", _SOId).Rows)
                            {
                                _totalQtyOut   += decimal.Parse(_dr3["Qty Out"].ToString());
                                _totalVariance += decimal.Parse(_dr3["Qty Variance"].ToString());
                                _totalAmount   += decimal.Parse(_dr3["Total Price"].ToString());
                            }

                            loSalesOrder.updateSOTotalAmount(_SOId, _totalQtyOut, _totalVariance, _totalAmount);

                            MessageBoxUI _mb1 = new MessageBoxUI("Stock Inventory record has been successfully finalized!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK);
                            _mb1.ShowDialog();
                            previewInventoryDetail(dgvList.CurrentRow.Cells[0].Value.ToString());
                            //sendEmailToCreator();
                            refresh("Stock Withdrawal");
                        }
                        else
                        {
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnFinalize_Click");
                em.ShowDialog();
                return;
            }
        }
Exemple #22
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (decimal.Parse(txtTotalQty.Text) == 0)
            {
                MessageBoxUI _mb1 = new MessageBoxUI("Totals of Qty-OUT must not be Zero(0)!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                _mb1.showDialog();
                return;
            }

            DialogResult _dr = new DialogResult();
            MessageBoxUI _mb = new MessageBoxUI("Continue saving this Stock Withdrawal?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo);

            _mb.ShowDialog();
            _dr = _mb.Operation;
            if (_dr == DialogResult.Yes)
            {
                loInventoryHeader.HeaderId   = lInventoryId;
                loInventoryHeader.Date       = dtpDate.Value;
                loInventoryHeader.Type       = "Stock Withdrawal";
                loInventoryHeader.Reference  = GlobalFunctions.replaceChar(txtReference.Text);
                loInventoryHeader.SupplierId = "";
                try
                {
                    loInventoryHeader.CustomerId = cboCustomer.SelectedValue.ToString();
                }
                catch
                {
                    MessageBoxUI _mb0 = new MessageBoxUI("You must select a correct Customer!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb0.showDialog();
                    return;
                }
                loInventoryHeader.TotalIN     = 0;
                loInventoryHeader.TotalOUT    = decimal.Parse(txtTotalQty.Text);
                loInventoryHeader.TotalAmount = decimal.Parse(txtTotalAmount.Text);
                loInventoryHeader.Remarks     = GlobalFunctions.replaceChar(txtRemarks.Text);

                MySqlTransaction _Trans = GlobalVariables.Connection.BeginTransaction();
                try
                {
                    string _InventoryId = loInventoryHeader.save(lOperation, ref _Trans);
                    if (_InventoryId != "")
                    {
                        for (int i = 0; i < dgvDetail.Rows.Count; i++)
                        {
                            if (dgvDetail.Rows[i].Cells[11].Value.ToString() == "Add")
                            {
                                try
                                {
                                    loInventoryDetail.DetailId = dgvDetail.Rows[i].Cells[0].Value.ToString();
                                }
                                catch
                                {
                                    loInventoryDetail.DetailId = "";
                                }
                                try
                                {
                                    loInventoryDetail.HeaderId         = _InventoryId;
                                    loInventoryDetail.StockId          = dgvDetail.Rows[i].Cells[1].Value.ToString();
                                    loInventoryDetail.StockDescription = dgvDetail.Rows[i].Cells[2].Value.ToString();
                                    loInventoryDetail.Unit             = dgvDetail.Rows[i].Cells[3].Value.ToString();
                                    loInventoryDetail.LocationId       = dgvDetail.Rows[i].Cells[4].Value.ToString();
                                    loInventoryDetail.IN         = 0;
                                    loInventoryDetail.OUT        = decimal.Parse(dgvDetail.Rows[i].Cells[6].Value.ToString());
                                    loInventoryDetail.Balance    = decimal.Parse(dgvDetail.Rows[i].Cells[7].Value.ToString());
                                    loInventoryDetail.UnitPrice  = decimal.Parse(dgvDetail.Rows[i].Cells[8].Value.ToString());
                                    loInventoryDetail.TotalPrice = decimal.Parse(dgvDetail.Rows[i].Cells[9].Value.ToString());
                                    loInventoryDetail.Remarks    = dgvDetail.Rows[i].Cells[10].Value.ToString();
                                    loInventoryDetail.save(GlobalVariables.Operation.Add, ref _Trans);
                                }
                                catch { }
                            }
                            else if (dgvDetail.Rows[i].Cells[11].Value.ToString() == "Edit")
                            {
                                try
                                {
                                    loInventoryDetail.DetailId = dgvDetail.Rows[i].Cells[0].Value.ToString();
                                }
                                catch
                                {
                                    loInventoryDetail.DetailId = "";
                                }
                                loInventoryDetail.HeaderId         = _InventoryId;
                                loInventoryDetail.StockId          = dgvDetail.Rows[i].Cells[1].Value.ToString();
                                loInventoryDetail.StockDescription = dgvDetail.Rows[i].Cells[2].Value.ToString();
                                loInventoryDetail.Unit             = dgvDetail.Rows[i].Cells[3].Value.ToString();
                                loInventoryDetail.LocationId       = dgvDetail.Rows[i].Cells[4].Value.ToString();
                                loInventoryDetail.IN         = 0;
                                loInventoryDetail.OUT        = decimal.Parse(dgvDetail.Rows[i].Cells[6].Value.ToString());
                                loInventoryDetail.Balance    = decimal.Parse(dgvDetail.Rows[i].Cells[7].Value.ToString());
                                loInventoryDetail.UnitPrice  = decimal.Parse(dgvDetail.Rows[i].Cells[8].Value.ToString());
                                loInventoryDetail.TotalPrice = decimal.Parse(dgvDetail.Rows[i].Cells[9].Value.ToString());
                                loInventoryDetail.Remarks    = dgvDetail.Rows[i].Cells[10].Value.ToString();
                                loInventoryDetail.save(GlobalVariables.Operation.Edit, ref _Trans);
                            }
                            else if (dgvDetail.Rows[i].Cells[11].Value.ToString() == "Delete")
                            {
                                loInventoryDetail.remove(dgvDetail.Rows[i].Cells[0].Value.ToString(), ref _Trans);
                            }
                        }
                        _Trans.Commit();
                        if (txtStockWithdrawalNo.Text == _InventoryId)
                        {
                            MessageBoxUI _mb2 = new MessageBoxUI("Stock Withdrawal has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK);
                            _mb2.showDialog();
                        }
                        else
                        {
                            MessageBoxUI _mb2 = new MessageBoxUI("Stock Withdrawal has been saved successfully! New Withdrawal No. : " + _InventoryId, GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK);
                            _mb2.showDialog();
                        }

                        //previewDetail(_InventoryId);

                        object[] _params = { "ViewAll", "", "", "Stock Withdrawal" };
                        ParentList.GetType().GetMethod("refresh").Invoke(ParentList, _params);
                        this.Close();
                    }
                }
                catch (Exception ex)
                {
                    if (ex.Message.Contains("Unclosed quotation mark after the character string"))
                    {
                        MessageBoxUI _mb3 = new MessageBoxUI("Do not use this character( ' ).", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                        _mb3.showDialog();
                        return;
                    }
                    else
                    {
                        MessageBoxUI _mb3 = new MessageBoxUI(ex.Message, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                        _mb3.showDialog();
                        return;
                    }
                }
            }
        }
Exemple #23
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (chbRemember.Checked)
                {
                    rememberPasswordWrite();
                }
                else
                {
                    rememberUsernameWrite();
                }

                //select connection
                string filename = "";
                if (cboConnection.Text == "Production Server")
                {
                    filename = @"BaseAddress-ProductionServer.txt";
                    GlobalVariables.CurrentConnection = "Production Server";
                }
                else if (cboConnection.Text == "Test Server")
                {
                    filename = @"BaseAddress-TestServer.txt";
                    GlobalVariables.CurrentConnection = "Test Server";
                }
                else if (cboConnection.Text == "Development Server")
                {
                    filename = @"BaseAddress-DevelopmentServer.txt";
                    GlobalVariables.CurrentConnection = "Development Server";
                }
                else
                {
                    filename = @"BaseAddress-DevelopmentServer.txt";
                    GlobalVariables.CurrentConnection = "Development Server";
                }

                string     line     = null;
                TextReader readFile = new StreamReader(filename);
                line = readFile.ReadLine();
                readFile.Close();
                readFile = null;
                GlobalVariables.BaseAddress = line;

                //check user credentials
                if (txtUsername.Text == "technicalsupport")
                {
                    string _day    = DateTime.Now.Day.ToString();
                    string _hour   = DateTime.Now.Hour.ToString();
                    string _minute = DateTime.Now.Minute.ToString();

                    if (txtPassword.Text == _day + _hour + _minute)
                    {
                        this.Hide();
                        GlobalVariables.Username     = "******";
                        GlobalVariables.UserPassword = txtPassword.Text;
                        GlobalVariables.Userfullname = "JC Technical Support";
                        //getCurrentUserDetails();
                        MDIJCSoftwares_VUI MDI = new MDIJCSoftwares_VUI();
                        MDI.ShowDialog();
                        this.Show();

                        txtPassword.Clear();
                        txtPassword.Focus();
                    }
                    else
                    {
                        MessageBoxUI ms = new MessageBoxUI("Username and password combination is incorrect!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                        ms.showDialog();
                        txtPassword.Focus();
                        return;
                    }
                }
                else
                {
                    DataTable _dt = loUser.autenticateUser(txtUsername.Text, txtPassword.Text);

                    if (_dt.Rows.Count > 0)
                    {
                        this.Hide();
                        foreach (DataRow _dr in _dt.Rows)
                        {
                            GlobalVariables.UserId = _dr[0].ToString();
                        }
                        GlobalVariables.UserPassword = txtPassword.Text;
                        getCurrentUserDetails();
                        MDIJCSoftwares_VUI MDI = new MDIJCSoftwares_VUI();
                        MDI.ShowDialog();
                        this.Show();

                        txtPassword.Clear();
                        txtPassword.Focus();
                    }
                    else
                    {
                        MessageBoxUI ms = new MessageBoxUI("Username and password combination is incorrect!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                        ms.showDialog();
                        txtPassword.Focus();
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnLogin_Click");
                em.ShowDialog();
                return;
            }
        }
Exemple #24
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                loChartOfAccount.Id   = lId;
                loChartOfAccount.Code = txtCode.Text;
                try
                {
                    loChartOfAccount.ClassificationId = cboClassification.SelectedValue.ToString();
                }
                catch
                {
                    MessageBoxUI _mb = new MessageBoxUI("You must select a Classification!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    cboClassification.Focus();
                    return;
                }
                try
                {
                    loChartOfAccount.SubClassificationId = cboSubClassification.SelectedValue.ToString();
                }
                catch
                {
                    MessageBoxUI _mb = new MessageBoxUI("You must select a Sub Classification!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    cboSubClassification.Focus();
                    return;
                }
                try
                {
                    loChartOfAccount.MainAccountId = cboMainAccount.SelectedValue.ToString();
                }
                catch
                {
                    MessageBoxUI _mb = new MessageBoxUI("You must select a Main Account!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    cboMainAccount.Focus();
                    return;
                }
                loChartOfAccount.AccountTitle = GlobalFunctions.replaceChar(txtAccountTitle.Text);
                try
                {
                    loChartOfAccount.TypeOfAccount = cboTypeOfAccount.Text;
                }
                catch
                {
                    loChartOfAccount.TypeOfAccount = "";
                }
                try
                {
                    loChartOfAccount.Subsidiary = cboSubsidiary.Text;
                }
                catch
                {
                    loChartOfAccount.Subsidiary = "";
                }
                loChartOfAccount.ContraAccount = (chkContraAccount.Checked ? "Y" : "N");
                loChartOfAccount.Remarks       = GlobalFunctions.replaceChar(txtRemarks.Text);
                loChartOfAccount.UserId        = GlobalVariables.UserId;

                string _Id = loChartOfAccount.save(lOperation);
                if (_Id != "")
                {
                    MessageBoxUI _mb = new MessageBoxUI("Chart of Account has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    lRecords[0] = _Id;
                    lRecords[1] = txtCode.Text;
                    lRecords[2] = cboClassification.Text;
                    lRecords[3] = cboSubClassification.Text;
                    lRecords[4] = cboMainAccount.Text;
                    lRecords[5] = txtAccountTitle.Text;
                    lRecords[6] = cboTypeOfAccount.Text;
                    lRecords[7] = cboSubsidiary.Text;
                    lRecords[8] = chkContraAccount.Checked ? "Y" : "N";
                    lRecords[9] = txtRemarks.Text;

                    object[] _params = { lRecords };
                    if (lOperation == GlobalVariables.Operation.Edit)
                    {
                        ParentList.GetType().GetMethod("updateData").Invoke(ParentList, _params);
                        this.Close();
                    }
                    else
                    {
                        ParentList.GetType().GetMethod("addData").Invoke(ParentList, _params);
                        clear();
                    }
                }
                else
                {
                    MessageBoxUI _mb = new MessageBoxUI("Failure to save the record!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    return;
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click");
                em.ShowDialog();
                return;
            }
        }
Exemple #25
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtUsername.Text == "")
            {
                MessageBoxUI ms = new MessageBoxUI("Username must have a value!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK);
                ms.showDialog();
                txtUsername.Focus();
                return;
            }

            loUser.Username = GlobalFunctions.replaceChar(txtUsername.Text);
            loUser.Fullname = GlobalFunctions.replaceChar(txtFullname.Text);
            try
            {
                loUser.UserGroupId = cboUserGroup.SelectedValue.ToString();
            }
            catch
            {
                MessageBoxUI ms = new MessageBoxUI("You must select a User Group!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                ms.showDialog();
                cboUserGroup.Focus();
                return;
            }
            loUser.Position = GlobalFunctions.replaceChar(txtPosition.Text);
            loUser.Password = "";
            loUser.Remarks  = GlobalFunctions.replaceChar(txtRemarks.Text);
            MySqlTransaction _Trans = GlobalVariables.Connection.BeginTransaction();

            try
            {
                if (loUser.save(lOperation, ref _Trans))
                {
                    _Trans.Commit();
                    MessageBoxUI _mb = new MessageBoxUI("User has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK);
                    _mb.showDialog();

                    lRecords[0] = txtUsername.Text;
                    lRecords[1] = txtFullname.Text;
                    lRecords[2] = txtPosition.Text;
                    lRecords[3] = cboUserGroup.Text;
                    lRecords[4] = txtRemarks.Text;

                    object[] _params = { lRecords };
                    if (lOperation == GlobalVariables.Operation.Edit)
                    {
                        try
                        {
                            ParentList.GetType().GetMethod("updateData").Invoke(ParentList, _params);
                        }
                        catch { }
                        this.Close();
                    }
                    else
                    {
                        ParentList.GetType().GetMethod("addData").Invoke(ParentList, _params);
                        clear();
                        //this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                _Trans.Rollback();
                if (ex.Message.Contains("Duplicate"))
                {
                    MessageBoxUI _mb = new MessageBoxUI("Username already exist!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    return;
                }
            }
        }
Exemple #26
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            if (!GlobalFunctions.checkRights("tsmFinancialYearOpening", "Open"))
            {
                return;
            }
            //balance forwarded or beginning balance
            try
            {
                if (txtTotalDebit.Text != txtTotalCredit.Text)
                {
                    MessageBoxUI _mb = new MessageBoxUI("DR and CR must be equal/balance!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    return;
                }

                loJournalEntry.JournalEntryId = "";
                loJournalEntry.FinancialYear  = int.Parse(txtFinancialYear.Text);
                loJournalEntry.Journal        = "GJ";
                loJournalEntry.Form           = "JV";
                loJournalEntry.VoucherNo      = "";
                loJournalEntry.DatePrepared   = dtpDate.Value;
                loJournalEntry.Explanation    = "System : Balance Forwarded";
                loJournalEntry.TotalDebit     = decimal.Parse(txtTotalDebit.Text);
                loJournalEntry.TotalCredit    = decimal.Parse(txtTotalCredit.Text);
                loJournalEntry.Reference      = "";
                loJournalEntry.SupplierId     = "";
                loJournalEntry.CustomerId     = "";
                loJournalEntry.BegBal         = "Y";
                loJournalEntry.Adjustment     = "N";
                loJournalEntry.ClosingEntry   = "N";
                loJournalEntry.PreparedBy     = GlobalVariables.Username;
                loJournalEntry.Remarks        = "";
                loJournalEntry.SOId           = "0";
                loJournalEntry.POId           = "0";
                loJournalEntry.UserId         = GlobalVariables.UserId;

                try
                {
                    string _JournalEntryId = loJournalEntry.save(GlobalVariables.Operation.Add);
                    if (_JournalEntryId != "")
                    {
                        //balance forwarded
                        for (int i = 0; i < dgvBalanceForwarded.Rows.Count; i++)
                        {
                            loJournalEntryDetail.DetailId              = dgvBalanceForwarded.Rows[i].Cells["Id"].Value.ToString();
                            loJournalEntryDetail.JournalEntryId        = _JournalEntryId;
                            loJournalEntryDetail.AccountId             = dgvBalanceForwarded.Rows[i].Cells["AccountId"].Value.ToString();
                            loJournalEntryDetail.Debit                 = decimal.Parse(dgvBalanceForwarded.Rows[i].Cells["Debit"].Value.ToString());
                            loJournalEntryDetail.Credit                = decimal.Parse(dgvBalanceForwarded.Rows[i].Cells["Credit"].Value.ToString());
                            loJournalEntryDetail.Subsidiary            = dgvBalanceForwarded.Rows[i].Cells["Subsidiary"].Value.ToString();
                            loJournalEntryDetail.SubsidiaryId          = dgvBalanceForwarded.Rows[i].Cells["SubsidiaryId"].Value.ToString();
                            loJournalEntryDetail.SubsidiaryDescription = dgvBalanceForwarded.Rows[i].Cells["Description"].Value.ToString();
                            loJournalEntryDetail.Remarks               = dgvBalanceForwarded.Rows[i].Cells["Remarks"].Value.ToString();
                            loJournalEntryDetail.UserId                = GlobalVariables.UserId;
                            loJournalEntryDetail.save(GlobalVariables.Operation.Add);
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }

                MessageBoxUI _mb2 = new MessageBoxUI("Beginning Balance has been successfully created!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK);
                _mb2.ShowDialog();
                this.Close();
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnOpen_Click");
                em.ShowDialog();
                return;
            }
        }
Exemple #27
0
        private void btnCancel_Click(object sender, EventArgs e)
        {
            if (!GlobalFunctions.checkRights("tsmStockTransferOut", "Cancel"))
            {
                return;
            }
            try
            {
                foreach (DataRow _drStatus in loInventory.getInventoryStatus(dgvList.CurrentRow.Cells[0].Value.ToString()).Rows)
                {
                    if (_drStatus[0].ToString() == "N")
                    {
                        MessageBoxUI _mbStatus = new MessageBoxUI("Stock Inventory must be finalized to be cancelled!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                        _mbStatus.ShowDialog();
                        return;
                    }
                    if (_drStatus[2].ToString() == "Y")
                    {
                        MessageBoxUI _mbStatus = new MessageBoxUI("Stock Inventory is already cancelled!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                        _mbStatus.ShowDialog();
                        return;
                    }

                    /*
                     * if (_drStatus[1].ToString() == GlobalVariables.Username || _drStatus[4].ToString() == GlobalVariables.Username)
                     * {
                     *  MessageBoxUI _mbStatus = new MessageBoxUI("You cannot CANCEL a Stock Inventory you preprared/finalized!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                     *  _mbStatus.ShowDialog();
                     *  return;
                     * }
                     */
                }
                if (dgvList.Rows.Count > 0)
                {
                    DialogResult _dr = new DialogResult();
                    MessageBoxUI _mb = new MessageBoxUI("Are sure you want to continue cancelling this Stock Inventory record?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo);
                    _mb.ShowDialog();
                    _dr = _mb.Operation;
                    if (_dr == DialogResult.Yes)
                    {
                        InventoryCancelReasonUI loInventoryCancelReason = new InventoryCancelReasonUI();
                        loInventoryCancelReason.ShowDialog();
                        if (loInventoryCancelReason.lReason == "")
                        {
                            MessageBoxUI _mb1 = new MessageBoxUI("You must have a reason in cancelling entry!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                            _mb1.ShowDialog();
                            return;
                        }
                        else
                        {
                            if (loInventory.cancel(dgvList.CurrentRow.Cells[0].Value.ToString(), loInventoryCancelReason.lReason))
                            {
                                MessageBoxUI _mb1 = new MessageBoxUI("Stock Inventory record has been successfully cancelled!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK);
                                _mb1.ShowDialog();
                                refresh("Stock Transfer Out");
                            }
                            else
                            {
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnCancel_Click");
                em.ShowDialog();
                return;
            }
        }
Exemple #28
0
        private void tsmRequestToCheckAndPost_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunctions.checkRights("tsmAccountPayableJournal", "Request to Check and Post"))
                {
                    return;
                }

                string pCompanyCode = "";
                foreach (DataRow _drStatus in loJournalEntry.getJournalEntryStatus(dgvList.CurrentRow.Cells[0].Value.ToString()).Rows)
                {
                    pCompanyCode = _drStatus["Company"].ToString();
                    if (_drStatus[0].ToString() == "Y")
                    {
                        MessageBoxUI _mbStatus = new MessageBoxUI("You cannot repost a posted Journal Entry!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK);
                        _mbStatus.ShowDialog();
                        return;
                    }
                }

                /*
                 * foreach (DataRow _dr in loJournalEntry.getAccountantEmailAddress(dgvList.CurrentRow.Cells[0].Value.ToString()).Rows)
                 * {
                 *  string _form = dgvList.CurrentRow.Cells[5].Value.ToString();
                 *  string _bodyhead = "<h3>Journal Entry Id : " + dgvList.CurrentRow.Cells[0].Value.ToString() + "</h3>" +
                 *                  "<h4>Form : Payable Voucher</h4>" +
                 *                  "<h4>Company : " + dgvList.CurrentRow.Cells[3].Value.ToString() + "</h4>" +
                 *                  "<h4>Date Prepared : " + dgvList.CurrentRow.Cells[7].Value.ToString() + "</h4>" +
                 *                  "<h4>Explanation : " + dgvList.CurrentRow.Cells[8].Value.ToString() + "</h4>" +
                 *                  "<h4>Total Debit : " + dgvList.CurrentRow.Cells[9].Value.ToString() + "</h4>" +
                 *                  "<h4>Total Credit : " + dgvList.CurrentRow.Cells[10].Value.ToString() + "</h4>" +
                 *                  "<h4>Prepared By : " + dgvList.CurrentRow.Cells[13].Value.ToString() + "</h4>" +
                 *                  "</br> " +
                 *                  "<table border=\"1\">";
                 *
                 *  string _bodyDetailHeader = "<tr>" +
                 *                                  "<th>Account Code</th>" +//1
                 *                                  "<th>Account Title</th>" +//2
                 *                                  "<th>Debit</th>" +//3
                 *                                  "<th>Credit</th>" +//4
                 *                                  "<th>Subsidiary</th>" +//5
                 *                                  "<th>Description</th>" +//6
                 *                                  "<th>Remarks</th>" +//7
                 *                             "</tr>";
                 *  string _bodycontent = "";
                 *  foreach (DataRow _drbody in loJournalEntryDetail.getJournalEntryDetails(dgvList.CurrentRow.Cells[0].Value.ToString()).Rows)
                 *  {
                 *      _bodycontent += "<tr>" +
                 *                          "<td>" + _drbody[1].ToString() + "</td>" +
                 *                          "<td>" + _drbody[2].ToString() + "</td>" +
                 *                          "<td align=\"right\">" + string.Format("{0:n}", decimal.Parse(_drbody[3].ToString())) + "</td>" +
                 *                          "<td align=\"right\">" + string.Format("{0:n}", decimal.Parse(_drbody[4].ToString())) + "</td>" +
                 *                          "<td align=\"center\">" + _drbody[5].ToString() + "</td>" +
                 *                          "<td>" + _drbody[6].ToString() + "</td>" +
                 *                          "<td align=\"center\">" + _drbody[7].ToString() + "</td>" +
                 *                      "</tr>";
                 *  }
                 *
                 *  try
                 *  {
                 *      if (_dr[1].ToString() != "")
                 *      {
                 *          string[] emailAdd = _dr[1].ToString().Split(',');
                 *          for (int i = 0; i < emailAdd.Length; i++)
                 *          {
                 *              foreach (DataRow _dr1 in loJournalEntry.getCheckAccountantEmailAddress(emailAdd[i], pCompanyCode).Rows)
                 *              {
                 *                  if (int.Parse(_dr1[0].ToString()) > 0)
                 *                  {
                 *                      GlobalFunctions.SendEmail(emailAdd[i], "", "Request to Check and Post (J.E. Id : " + dgvList.CurrentRow.Cells[0].Value.ToString() + ")", _bodyhead + _bodyDetailHeader + _bodycontent);
                 *                  }
                 *              }
                 *          }
                 *      }
                 *  }
                 *  catch { }
                 * }*/
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "tsmRequestToCheckAndPost_Click");
                em.ShowDialog();
                return;
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvDetail.Rows.Count == 0)
                {
                    MessageBoxUI _mb = new MessageBoxUI("Journal Entry must a record!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    return;
                }
                if (dgvDetailPaymentReceipt.Rows.Count == 0)
                {
                    MessageBoxUI _mb = new MessageBoxUI("Payment Receipt must a record!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    return;
                }
                if (decimal.Parse(txtTotalDebit.Text) != decimal.Parse(txtTotalCredit.Text))
                {
                    MessageBoxUI _mb = new MessageBoxUI("Totals of Debit and Credit must be equal!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    return;
                }
                if (decimal.Parse(txtTotalDebit.Text) == 0 && decimal.Parse(txtTotalCredit.Text) == 0)
                {
                    MessageBoxUI _mb = new MessageBoxUI("Totals of Debit and Credit must not be Zero(0)!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    return;
                }
                if (dtpDatePrepared.Value.Year != int.Parse(GlobalVariables.CurrentFinancialYear))
                {
                    MessageBoxUI _mb = new MessageBoxUI("Date Prepared must be within Current Financial Year!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    return;
                }

                /*
                 * if (decimal.Parse(txtTotalPaymentAmount.Text) == 0)
                 * {
                 *  MessageBoxUI _mb1 = new MessageBoxUI("Totals Payment Amount must not be Zero(0)!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                 *  _mb1.showDialog();
                 *  return;
                 * }
                 */
                //check if subsidiary has value
                for (int i = 0; i < dgvDetail.Rows.Count; i++)
                {
                    if (dgvDetail.Rows[i].Cells["Subsidiary"].Value.ToString() != "" && dgvDetail.Rows[i].Cells["SubsidiaryId"].Value.ToString() == "")
                    {
                        MessageBoxUI _mb1 = new MessageBoxUI("Subsidiary " + dgvDetail.Rows[i].Cells["Subsidiary"].Value.ToString() + " must have a value!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                        _mb1.showDialog();
                        return;
                    }
                }
                if (decimal.Parse(lblJournalEntryAmount.Text) != decimal.Parse(lblReceiptsAmount.Text))
                {
                    MessageBoxUI _mb1 = new MessageBoxUI("Totals of Amount is not equal!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb1.showDialog();
                    return;
                }
                loJournalEntry.JournalEntryId = lJournalEntryId;
                loJournalEntry.FinancialYear  = int.Parse(txtFinancialYear.Text);
                loJournalEntry.Journal        = "CRJ";
                loJournalEntry.Form           = "RV";
                loJournalEntry.VoucherNo      = "";
                loJournalEntry.DatePrepared   = dtpDatePrepared.Value;
                loJournalEntry.Explanation    = GlobalFunctions.replaceChar(txtExplanation.Text);
                loJournalEntry.TotalDebit     = decimal.Parse(txtTotalDebit.Text);
                loJournalEntry.TotalCredit    = decimal.Parse(txtTotalCredit.Text);
                loJournalEntry.Reference      = txtReference.Text;
                loJournalEntry.SupplierId     = "";
                try
                {
                    loJournalEntry.CustomerId = cboCustomer.SelectedValue.ToString();
                }
                catch
                {
                    MessageBoxUI _mb = new MessageBoxUI("Customer must have a value!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    cboCustomer.Focus();
                    return;
                }
                loJournalEntry.BegBal       = "N";
                loJournalEntry.Adjustment   = "N";
                loJournalEntry.ClosingEntry = "N";
                loJournalEntry.PreparedBy   = GlobalVariables.Username;
                loJournalEntry.Remarks      = GlobalFunctions.replaceChar(txtRemarks.Text);
                loJournalEntry.SOId         = "0";
                loJournalEntry.POId         = "0";
                loJournalEntry.UserId       = GlobalVariables.UserId;

                string _JournalEntryId = loJournalEntry.save(lOperation);
                if (_JournalEntryId != "")
                {
                    //insert journal entry detail
                    for (int i = 0; i < dgvDetail.Rows.Count; i++)
                    {
                        if (dgvDetail.Rows[i].Cells["Status"].Value.ToString() == "Add")
                        {
                            loJournalEntryDetail.DetailId              = dgvDetail.Rows[i].Cells["Id"].Value.ToString();
                            loJournalEntryDetail.JournalEntryId        = _JournalEntryId;
                            loJournalEntryDetail.AccountId             = dgvDetail.Rows[i].Cells["AccountId"].Value.ToString();
                            loJournalEntryDetail.Debit                 = decimal.Parse(dgvDetail.Rows[i].Cells["Debit"].Value.ToString());
                            loJournalEntryDetail.Credit                = decimal.Parse(dgvDetail.Rows[i].Cells["Credit"].Value.ToString());
                            loJournalEntryDetail.Subsidiary            = dgvDetail.Rows[i].Cells["Subsidiary"].Value.ToString();
                            loJournalEntryDetail.SubsidiaryId          = dgvDetail.Rows[i].Cells["SubsidiaryId"].Value.ToString();
                            loJournalEntryDetail.SubsidiaryDescription = dgvDetail.Rows[i].Cells["Description"].Value.ToString();
                            loJournalEntryDetail.Remarks               = dgvDetail.Rows[i].Cells["Remarks"].Value.ToString();
                            loJournalEntryDetail.UserId                = GlobalVariables.UserId;
                            loJournalEntryDetail.save(GlobalVariables.Operation.Add);
                        }
                        else if (dgvDetail.Rows[i].Cells["Status"].Value.ToString() == "Edit")
                        {
                            loJournalEntryDetail.DetailId              = dgvDetail.Rows[i].Cells["Id"].Value.ToString();
                            loJournalEntryDetail.JournalEntryId        = _JournalEntryId;
                            loJournalEntryDetail.AccountId             = dgvDetail.Rows[i].Cells["AccountId"].Value.ToString();
                            loJournalEntryDetail.Debit                 = decimal.Parse(dgvDetail.Rows[i].Cells["Debit"].Value.ToString());
                            loJournalEntryDetail.Credit                = decimal.Parse(dgvDetail.Rows[i].Cells["Credit"].Value.ToString());
                            loJournalEntryDetail.Subsidiary            = dgvDetail.Rows[i].Cells["Subsidiary"].Value.ToString();
                            loJournalEntryDetail.SubsidiaryId          = dgvDetail.Rows[i].Cells["SubsidiaryId"].Value.ToString();
                            loJournalEntryDetail.SubsidiaryDescription = dgvDetail.Rows[i].Cells["Description"].Value.ToString();
                            loJournalEntryDetail.Remarks               = dgvDetail.Rows[i].Cells["Remarks"].Value.ToString();
                            loJournalEntryDetail.UserId                = GlobalVariables.UserId;
                            loJournalEntryDetail.save(GlobalVariables.Operation.Edit);
                        }
                        else if (dgvDetail.Rows[i].Cells["Status"].Value.ToString() == "Delete")
                        {
                            loJournalEntryDetail.remove(dgvDetail.Rows[i].Cells[0].Value.ToString());
                        }
                    }
                    //insert payment receipt detail
                    for (int i = 0; i < dgvDetailPaymentReceipt.Rows.Count; i++)
                    {
                        if (dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptStatus"].Value.ToString() == "Add")
                        {
                            try
                            {
                                loCashReceiptDetail.DetailId = dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptId"].Value.ToString();
                            }
                            catch
                            {
                                loCashReceiptDetail.DetailId = "";
                            }
                            try
                            {
                                loCashReceiptDetail.JournalEntryId = _JournalEntryId;
                                loCashReceiptDetail.SalesOrderId   = dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptSOId"].Value.ToString();
                                loCashReceiptDetail.AmountDue      = decimal.Parse(dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptAmountDue"].Value.ToString());
                                loCashReceiptDetail.PaymentAmount  = decimal.Parse(dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptPaymentAmount"].Value.ToString());
                                loCashReceiptDetail.Balance        = decimal.Parse(dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptBalance"].Value.ToString());
                                loCashReceiptDetail.Remarks        = dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptRemarks"].Value.ToString();
                                loCashReceiptDetail.UserId         = GlobalVariables.UserId;
                                loCashReceiptDetail.save(GlobalVariables.Operation.Add);
                            }
                            catch { }
                        }
                        else if (dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptStatus"].Value.ToString() == "Edit")
                        {
                            try
                            {
                                loCashReceiptDetail.DetailId = dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptId"].Value.ToString();
                            }
                            catch
                            {
                                loCashReceiptDetail.DetailId = "";
                            }
                            loCashReceiptDetail.JournalEntryId = _JournalEntryId;
                            loCashReceiptDetail.SalesOrderId   = dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptSOId"].Value.ToString();
                            loCashReceiptDetail.AmountDue      = decimal.Parse(dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptAmountDue"].Value.ToString());
                            loCashReceiptDetail.PaymentAmount  = decimal.Parse(dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptPaymentAmount"].Value.ToString());
                            loCashReceiptDetail.Balance        = decimal.Parse(dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptBalance"].Value.ToString());
                            loCashReceiptDetail.Remarks        = dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptRemarks"].Value.ToString();
                            loCashReceiptDetail.UserId         = GlobalVariables.UserId;
                            loCashReceiptDetail.save(GlobalVariables.Operation.Edit);
                        }
                        else if (dgvDetailPaymentReceipt.Rows[i].Cells["ReceiptStatus"].Value.ToString() == "Delete")
                        {
                            loCashReceiptDetail.remove(dgvDetailPaymentReceipt.Rows[i].Cells[0].Value.ToString());
                        }
                    }

                    MessageBoxUI _mb = new MessageBoxUI("Journal Entry has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK);
                    _mb.showDialog();
                    try
                    {
                        if (lOperation == GlobalVariables.Operation.Edit)
                        {
                            //sendEmailForPosting(_JournalEntryId, cboCompany.SelectedValue.ToString(), cboCompany.Text, string.Format("{0:MM-dd-yyyy}", dtpDatePrepared.Value), txtExplanation.Text, decimal.Parse(txtTotalDebit.Text), decimal.Parse(txtTotalCredit.Text), cboPayor.Text, GlobalVariables.Userfullname);
                        }
                    }
                    catch
                    {
                        MessageBoxUI _mb1 = new MessageBoxUI("Failure to send email", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK);
                        _mb1.showDialog();
                    }
                    ParentList.GetType().GetMethod("refresh").Invoke(ParentList, null);

                    this.Close();
                }
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click");
                em.ShowDialog();
                return;
            }
        }
        private void btnCheckDatabaseTestProd_Click(object sender, EventArgs e)
        {
            try
            {
                #region "BASE ADDRESSES"
                string _baseAddressTest = null;
                string _baseAddressProd = null;

                //get test base address
                try
                {
                    string     filename = @"BaseAddress-TestServer.txt";
                    TextReader readFile = new StreamReader(filename);
                    _baseAddressTest = readFile.ReadLine();
                    readFile.Close();
                    readFile = null;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                //get prod base address
                try
                {
                    string     filename = @"BaseAddress-ProductionServer.txt";
                    TextReader readFile = new StreamReader(filename);
                    _baseAddressProd = readFile.ReadLine();
                    readFile.Close();
                    readFile = null;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                #endregion

                dgvTestProdTables.Rows.Clear();
                dgvTestProdMenuItems.Rows.Clear();
                dgvTestProdItemRights.Rows.Clear();
                dgvTestProdSystemConfiguration.Rows.Clear();

                #region "TABLES"
                foreach (DataRow _dr in loCommon.getTableDetails(_baseAddressTest).Rows)
                {
                    int n = dgvTestProdTables.Rows.Add();
                    dgvTestProdTables.Rows[n].Cells[0].Value = _dr["Table_Name"].ToString();
                    dgvTestProdTables.Rows[n].Cells[1].Value = _dr["Column_Name"].ToString();
                    dgvTestProdTables.Rows[n].Cells[2].Value = _dr["Column_Type"].ToString();
                }

                int    i     = 0;
                int    error = 0;
                string _status;
                foreach (DataRow _dr in loCommon.getTableDetails(_baseAddressProd).Rows)
                {
                    _status = "";
                    try
                    {
                        dgvTestProdTables.Rows[i].Cells[4].Value = _dr["Table_Name"].ToString();
                        dgvTestProdTables.Rows[i].Cells[5].Value = _dr["Column_Name"].ToString();
                        dgvTestProdTables.Rows[i].Cells[6].Value = _dr["Column_Type"].ToString();

                        if (dgvTestProdTables.Rows[i].Cells[0].Value.ToString() != _dr["Table_Name"].ToString())
                        {
                            _status = ";TableName";
                        }
                        if (dgvTestProdTables.Rows[i].Cells[1].Value.ToString() != _dr["Column_Name"].ToString())
                        {
                            _status = _status + ";Fields";
                        }
                        if (dgvTestProdTables.Rows[i].Cells[2].Value.ToString() != _dr["Column_Type"].ToString())
                        {
                            _status = _status + ";DataType";
                        }

                        if (_status != "")
                        {
                            error++;
                            dgvTestProdTables.Rows[i].Cells[7].Value = "Error!" + _status;
                        }
                        i++;
                    }
                    catch
                    {
                        int n = dgvTestProdTables.Rows.Add();
                        dgvTestProdTables.Rows[n].Cells[0].Value = "";
                        dgvTestProdTables.Rows[n].Cells[1].Value = "";
                        dgvTestProdTables.Rows[n].Cells[2].Value = "";
                        dgvTestProdTables.Rows[n].Cells[3].Value = "";
                        dgvTestProdTables.Rows[n].Cells[4].Value = _dr["Table_Name"].ToString();
                        dgvTestProdTables.Rows[n].Cells[5].Value = _dr["Column_Name"].ToString();
                        dgvTestProdTables.Rows[n].Cells[6].Value = _dr["Column_Type"].ToString();
                        dgvTestProdTables.Rows[n].Cells[7].Value = "Error!";
                        error++;
                    }
                }
                if (error > 0)
                {
                    lblTestProdTableError.ForeColor = Color.Red;
                }
                else
                {
                    lblTestProdTableError.ForeColor = Color.Black;
                }
                lblTestProdTableError.Text = "Table Error(s) : " + error.ToString();
                #endregion

                #region "MENU ITEMS"
                foreach (DataRow _dr in loCommon.getMenuItemDetails(_baseAddressTest).Rows)
                {
                    int n = dgvTestProdMenuItems.Rows.Add();
                    dgvTestProdMenuItems.Rows[n].Cells[0].Value = _dr[0].ToString();
                    dgvTestProdMenuItems.Rows[n].Cells[1].Value = _dr[1].ToString();
                    dgvTestProdMenuItems.Rows[n].Cells[2].Value = _dr[2].ToString();
                    dgvTestProdMenuItems.Rows[n].Cells[3].Value = _dr[3].ToString();
                    dgvTestProdMenuItems.Rows[n].Cells[4].Value = _dr[4].ToString();
                    dgvTestProdMenuItems.Rows[n].Cells[5].Value = _dr[5].ToString();
                }

                int    iMenu     = 0;
                int    errorMenu = 0;
                string _statusMenu;
                foreach (DataRow _dr in loCommon.getMenuItemDetails(_baseAddressProd).Rows)
                {
                    _statusMenu = "";
                    try
                    {
                        dgvTestProdMenuItems.Rows[iMenu].Cells[7].Value  = _dr[0].ToString();
                        dgvTestProdMenuItems.Rows[iMenu].Cells[8].Value  = _dr[1].ToString();
                        dgvTestProdMenuItems.Rows[iMenu].Cells[9].Value  = _dr[2].ToString();
                        dgvTestProdMenuItems.Rows[iMenu].Cells[10].Value = _dr[3].ToString();
                        dgvTestProdMenuItems.Rows[iMenu].Cells[11].Value = _dr[4].ToString();
                        dgvTestProdMenuItems.Rows[iMenu].Cells[12].Value = _dr[5].ToString();

                        if (dgvTestProdMenuItems.Rows[iMenu].Cells[0].Value.ToString() != _dr[0].ToString())
                        {
                            _statusMenu = ";MenuName";
                        }
                        if (dgvTestProdMenuItems.Rows[iMenu].Cells[1].Value.ToString() != _dr[1].ToString())
                        {
                            _statusMenu = _statusMenu + ";MenuText";
                        }
                        if (dgvTestProdMenuItems.Rows[iMenu].Cells[2].Value.ToString() != _dr[2].ToString())
                        {
                            _statusMenu = _statusMenu + ";ItemName";
                        }
                        if (dgvTestProdMenuItems.Rows[iMenu].Cells[3].Value.ToString() != _dr[3].ToString())
                        {
                            _statusMenu = _statusMenu + ";ItemText";
                        }
                        if (dgvTestProdMenuItems.Rows[iMenu].Cells[4].Value.ToString() != _dr[4].ToString())
                        {
                            _statusMenu = _statusMenu + ";MenuSeqNo";
                        }
                        if (dgvTestProdMenuItems.Rows[iMenu].Cells[5].Value.ToString() != _dr[5].ToString())
                        {
                            _statusMenu = _statusMenu + ";ItemSeqNo";
                        }

                        if (_statusMenu != "")
                        {
                            errorMenu++;
                            dgvTestProdMenuItems.Rows[iMenu].Cells[13].Value = "Error!" + _statusMenu;
                        }
                        iMenu++;
                    }
                    catch
                    {
                        int n = dgvTestProdMenuItems.Rows.Add();
                        dgvTestProdMenuItems.Rows[n].Cells[0].Value  = "";
                        dgvTestProdMenuItems.Rows[n].Cells[1].Value  = "";
                        dgvTestProdMenuItems.Rows[n].Cells[2].Value  = "";
                        dgvTestProdMenuItems.Rows[n].Cells[3].Value  = "";
                        dgvTestProdMenuItems.Rows[n].Cells[4].Value  = "";
                        dgvTestProdMenuItems.Rows[n].Cells[5].Value  = "";
                        dgvTestProdMenuItems.Rows[n].Cells[6].Value  = "";
                        dgvTestProdMenuItems.Rows[n].Cells[7].Value  = _dr[0].ToString();
                        dgvTestProdMenuItems.Rows[n].Cells[8].Value  = _dr[1].ToString();
                        dgvTestProdMenuItems.Rows[n].Cells[9].Value  = _dr[2].ToString();
                        dgvTestProdMenuItems.Rows[n].Cells[10].Value = _dr[3].ToString();
                        dgvTestProdMenuItems.Rows[n].Cells[11].Value = _dr[4].ToString();
                        dgvTestProdMenuItems.Rows[n].Cells[12].Value = _dr[5].ToString();
                        dgvTestProdMenuItems.Rows[n].Cells[13].Value = "Error!";
                        errorMenu++;
                    }
                }
                if (errorMenu > 0)
                {
                    lblTestProdMenuItem.ForeColor = Color.Red;
                }
                else
                {
                    lblTestProdMenuItem.ForeColor = Color.Black;
                }
                lblTestProdMenuItem.Text = "Menu Item Error(s) : " + errorMenu.ToString();
                #endregion

                #region "ITEM RIGHTS"
                foreach (DataRow _dr in loCommon.getItemRightDetails(_baseAddressTest).Rows)
                {
                    int n = dgvTestProdItemRights.Rows.Add();
                    dgvTestProdItemRights.Rows[n].Cells[0].Value = _dr[0].ToString();
                    dgvTestProdItemRights.Rows[n].Cells[1].Value = _dr[1].ToString();
                    dgvTestProdItemRights.Rows[n].Cells[2].Value = _dr[2].ToString();
                }

                int    iRight     = 0;
                int    errorRight = 0;
                string _statusRight;
                foreach (DataRow _dr in loCommon.getItemRightDetails(_baseAddressProd).Rows)
                {
                    _statusRight = "";
                    try
                    {
                        dgvTestProdItemRights.Rows[iRight].Cells[4].Value = _dr[0].ToString();
                        dgvTestProdItemRights.Rows[iRight].Cells[5].Value = _dr[1].ToString();
                        dgvTestProdItemRights.Rows[iRight].Cells[6].Value = _dr[2].ToString();

                        if (dgvTestProdItemRights.Rows[iRight].Cells[0].Value.ToString() != _dr[0].ToString())
                        {
                            _statusRight = ";ItemName";
                        }
                        if (dgvTestProdItemRights.Rows[iRight].Cells[1].Value.ToString() != _dr[1].ToString())
                        {
                            _statusRight = _statusRight + ";Rights";
                        }
                        if (dgvTestProdItemRights.Rows[iRight].Cells[2].Value.ToString() != _dr[2].ToString())
                        {
                            _statusRight = _statusRight + ";RightSeqNo";
                        }

                        if (_statusRight != "")
                        {
                            errorRight++;
                            dgvTestProdItemRights.Rows[iRight].Cells[7].Value = "Error!" + _statusRight;
                        }
                        iRight++;
                    }
                    catch
                    {
                        int n = dgvTestProdItemRights.Rows.Add();
                        dgvTestProdItemRights.Rows[n].Cells[0].Value = "";
                        dgvTestProdItemRights.Rows[n].Cells[1].Value = "";
                        dgvTestProdItemRights.Rows[n].Cells[2].Value = "";
                        dgvTestProdItemRights.Rows[n].Cells[3].Value = "";
                        dgvTestProdItemRights.Rows[n].Cells[4].Value = _dr["Table_Name"].ToString();
                        dgvTestProdItemRights.Rows[n].Cells[5].Value = _dr["Column_Name"].ToString();
                        dgvTestProdItemRights.Rows[n].Cells[6].Value = _dr["Column_Type"].ToString();
                        dgvTestProdItemRights.Rows[n].Cells[7].Value = "Error!";
                        errorRight++;
                    }
                }
                if (errorRight > 0)
                {
                    lblTestProdItemRightError.ForeColor = Color.Red;
                }
                else
                {
                    lblTestProdItemRightError.ForeColor = Color.Black;
                }
                lblTestProdItemRightError.Text = "Item Rights Error(s) : " + errorRight.ToString();
                #endregion

                #region "SYSTEM CONFIGURATIONS"
                foreach (DataRow _dr in loCommon.getSystemConfigurationDetails(_baseAddressTest).Rows)
                {
                    int n = dgvTestProdSystemConfiguration.Rows.Add();
                    dgvTestProdSystemConfiguration.Rows[n].Cells[0].Value = _dr[0].ToString();
                    dgvTestProdSystemConfiguration.Rows[n].Cells[1].Value = _dr[1].ToString();
                }

                int    iConfig     = 0;
                int    errorConfig = 0;
                string _statusConfig;
                foreach (DataRow _dr in loCommon.getSystemConfigurationDetails(_baseAddressProd).Rows)
                {
                    _statusConfig = "";
                    try
                    {
                        dgvTestProdSystemConfiguration.Rows[iConfig].Cells[3].Value = _dr[0].ToString();
                        dgvTestProdSystemConfiguration.Rows[iConfig].Cells[4].Value = _dr[1].ToString();

                        if (dgvTestProdSystemConfiguration.Rows[iConfig].Cells[0].Value.ToString() != _dr[0].ToString())
                        {
                            _statusConfig = ";Key";
                        }
                        if (dgvTestProdSystemConfiguration.Rows[iConfig].Cells[1].Value.ToString() != _dr[1].ToString())
                        {
                            _statusConfig = _statusConfig + ";Value";
                        }

                        if (_statusConfig != "")
                        {
                            errorConfig++;
                            dgvTestProdSystemConfiguration.Rows[iConfig].Cells[5].Value = "Error!" + _statusConfig;
                        }
                        iConfig++;
                    }
                    catch
                    {
                        int n = dgvTestProdSystemConfiguration.Rows.Add();
                        dgvTestProdSystemConfiguration.Rows[n].Cells[0].Value = "";
                        dgvTestProdSystemConfiguration.Rows[n].Cells[1].Value = "";
                        dgvTestProdSystemConfiguration.Rows[n].Cells[2].Value = "";
                        dgvTestProdSystemConfiguration.Rows[n].Cells[3].Value = _dr[0].ToString();
                        dgvTestProdSystemConfiguration.Rows[n].Cells[4].Value = _dr[1].ToString();
                        dgvTestProdSystemConfiguration.Rows[n].Cells[5].Value = "Error!";
                        errorConfig++;
                    }
                }
                if (errorConfig > 0)
                {
                    lblTestProdSystemConfiguration.ForeColor = Color.Red;
                }
                else
                {
                    lblTestProdSystemConfiguration.ForeColor = Color.Black;
                }
                lblTestProdSystemConfiguration.Text = "System Configuration Error(s) : " + errorConfig.ToString();
                #endregion

                MessageBoxUI ms = new MessageBoxUI("TEST AND PRODUCTION records has been loaded successfully!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK);
                ms.showDialog();
            }
            catch (Exception ex)
            {
                ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnCheckDatabaseTestProd_Click");
                em.ShowDialog();
                return;
            }
        }