Пример #1
0
        public clsBaseListItem findclsBaseListItem(string val, List <clsBaseListItem> list)
        {
            clsBaseListItem Result = new clsBaseListItem();

            Result = list.Find(x => x.strValue1 == val);
            return(Result);
        }
Пример #2
0
        private void disEnableButtons()
        {
            bool isOk = true;

            if (cmbCashBox.SelectedIndex < 0)
            {
                isOk = false;
            }
            else
            {
                //if (CashBox.CashBoxes.Rows[cmbCashBox.SelectedIndex]["NEED_DENOMINATION"].ToString() == "1")
                //{
                //   if (Decimal.Parse(this.dfClosingBalance.Text.ToString()) != nTotal) isOk = false;
                //}
                clsBaseListItem selectedListItem = (clsBaseListItem)cmbCashBox.SelectedItem;
                if (selectedListItem.nValue1 == 1)
                {
                    if (Decimal.Parse(this.dfClosingBalance.Text.ToString()) != nTotal)
                    {
                        isOk = false;
                    }
                }
            }
            if (isOk)
            {
                this.pbOK.Enabled = true;
            }
            else
            {
                this.pbOK.Enabled = false;
            }
        }
Пример #3
0
        private void cmbCashBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                clsBaseListItem selectedListItem = (clsBaseListItem)cmbCashBox.SelectedItem;
                String          strCashBoxId     = selectedListItem.strValue1;//cmbCashBox.Text.Substring(0, cmbCashBox.Text.IndexOf("="));

                if (strCashBoxId != "")
                {
                    int     CashBoxInd  = CashBox.getIndexByCashBoxId(strCashBoxId);
                    String  strCurCd    = CashBox.CashBoxes.Rows[CashBoxInd]["CURCD"].ToString();
                    decimal nClosingQty = 0;
                    dfClosingBalance.Text = string.Format("{0:#,0.00}", CashBox.getClosingBalance(strCashBoxId, out nClosingQty));
                    dfClosingQty.Text     = string.Format("{0:#,0.00}", nClosingQty);
                    this.gridDenomination.Rows.Clear();
                    //Fill denomination
                    if (selectedListItem.nValue1 == 1) //Need denomination
                    {
                        gridDenomination.Enabled = true;
                        clsSqlFactory hSql = new clsSqlFactory();
                        hSql.NewCommand("select V1,C2,C4 from " + objUtil.getTable("CORW") + " a where a.CODAID ='CASHDENOM' and  a.C3 = ? ");
                        hSql.Com.Parameters.AddWithValue("CURCD", strCurCd);
                        hSql.ExecuteReader();
                        int i = 0;
                        while (hSql.Read())
                        {
                            gridDenomination.Rows.Add();
                            gridDenomination.Rows[i].Cells["colIsCoin"].Value    = hSql.Reader.GetInt32(0);
                            gridDenomination.Rows[i].Cells["colCaption"].Value   = hSql.Reader.GetString(1);
                            gridDenomination.Rows[i].Cells["colFaceValue"].Value = hSql.Reader.GetString(2);
                            gridDenomination.Rows[i].Cells["colCount"].Value     = string.Format("{0:#,0}", Int32.Parse("0"));
                            gridDenomination.Rows[i].Cells["colTotal"].Value     = string.Format("{0:#,0.00}", Decimal.Parse("0"));

                            i++;
                        }
                        gridDenomination.CurrentCell = gridDenomination.Rows[0].Cells["colCount"];
                        gridDenomination.BeginEdit(true);
                    }
                    else
                    {
                        gridDenomination.Enabled = false;
                    }
                    //En_disable OK button
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                MessageBox.Show(objUtil.Localization.getMsgString("CASHREG_03"));//Select Cashbox !
            }
            finally
            {
                disEnableButtons();
            }
        }
Пример #4
0
        public SubContractorContract RowToSubcontractor(DataGridViewRow row)
        {
            SubContractorContract sc = new SubContractorContract();
            int  number = -1;
            bool tmp    = Int32.TryParse(row.Cells[0].Value.ToString(), out number);

            if (tmp)
            {
                sc.OID = number;
            }
            else
            {
                sc.OID = 0;
            }

            sc.SubcontractNo = row.Cells["colSubcontractNo"].Value != null ? row.Cells["colSubcontractNo"].Value.ToString() : "";
            sc.Info          = row.Cells["colInfo"].Value != null ? row.Cells["colInfo"].Value.ToString() : "";
            sc.Expl          = row.Cells["colExpl"].Value != null ? row.Cells["colExpl"].Value.ToString() : "";
            if ((DateTime)(row.Cells["colDateLimit"].Value) > DateTime.MinValue)
            {
                sc.DateLimit = MyUtils.strToDate(row.Cells["colDateLimit"].Value.ToString(), objGlobal.CultureInfo);
            }
            sc.KmLimit = row.Cells["colKmLimit"].Value != null ? (int)row.Cells["colKmLimit"].Value : 0;



            var  temp = (decimal)0;
            bool rs   = Decimal.TryParse(row.Cells["colBuyPrice"].Value.ToString(), out temp);

            if (rs)
            {
                sc.BuyPrice = Math.Round(temp, 2);
            }
            else
            {
                sc.BuyPrice = (decimal)0;
            }


            sc.SuplNoVal = row.Cells["colSuplNoVal"].Value != null ? row.Cells["colSuplNoVal"].Value.ToString() : "";
            sc.SuplName  = row.Cells["colSuplName"].Value != null ? row.Cells["colSuplName"].Value.ToString() : "";

            sc.isDeleted = (bool)row.Cells["colIsDeleted"].Value;

            clsBaseListItem t = new clsBaseListItem();

            t.strValue1 = sc.SuplNoVal;
            t.strText   = sc.SuplName;
            sc.SuplNo   = t;

            return(sc);
        }
Пример #5
0
        private void dlgCloseCashBox_Load(object sender, EventArgs e)
        {
            this.ContextMenuStrip.Items[this.ContextMenuStrip.Items.IndexOfKey("scheduleTaskToolStripMenuItem")].Enabled = false;

            CashBox.load();
            gridDenomination.Columns["colCount"].HeaderCell.Style.Alignment     = DataGridViewContentAlignment.MiddleRight;
            gridDenomination.Columns["colFaceValue"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
            gridDenomination.Columns["colTotal"].HeaderCell.Style.Alignment     = DataGridViewContentAlignment.MiddleRight;
            this.dfTotal.Text      = "0";
            this.dfTotalCoins.Text = "0";
            this.dfTotalNotes.Text = "0";
            gridDenomination.Columns["colCount"].ReadOnly = false;
            disableColumn(this.gridDenomination.Columns["colCaption"]);
            disableColumn(this.gridDenomination.Columns["colFaceValue"]);
            disableColumn(this.gridDenomination.Columns["colTotal"]);
            int i = 0;

            while (i < CashBox.CashBoxes.Rows.Count)
            {
                _log.Debug("CashBoxId = " + CashBox.CashBoxes.Rows[i]["CASHBOXID"].ToString() + ",IsOpen = " + CashBox.CashBoxes.Rows[i]["ISOPEN"].ToString() + ", Virtual = " + CashBox.CashBoxes.Rows[i]["VIRTUAL"].ToString());
                if
                (
                    (CashBox.CashBoxes.Rows[i]["ISOPEN"].ToString() == "1") &&
                    (
                        objGlobal.ExtendedRights || CashBox.CashBoxes.Rows[i]["PC"].ToString() == CashBox.getClientPCName() || CashBox.CashBoxes.Rows[i]["VIRTUAL"].ToString() == "1"
                    )
                )
                {
                    clsBaseListItem objListItem = new clsBaseListItem();
                    objListItem.strText   = CashBox.CashBoxes.Rows[i]["CASHBOXID"].ToString() + "=" + CashBox.CashBoxes.Rows[i]["NAME"].ToString() + "/" + CashBox.CashBoxes.Rows[i]["PC"].ToString();
                    objListItem.strValue1 = CashBox.CashBoxes.Rows[i]["CASHBOXID"].ToString();
                    objListItem.nValue1   = Int32.Parse(CashBox.CashBoxes.Rows[i]["NEED_DENOMINATION"].ToString());
                    cmbCashBox.Items.Add(objListItem);
                }
                i++;
            }
            try {
                //cmbCashBox_SelectedIndexChanged(null, null);
            }
            catch (Exception ex)
            { }
        }
Пример #6
0
        public void updateContract()
        {
            objContract.ExtContractNo = this.headerControl1.txtExtContractNr.Text;
            objContract.IsStatistic   = this.headerControl1.cbStatistic.Checked;
            if (this.headerControl1.cbxCostcenter.SelectedIndex >= 0)
            {
                if (this.headerControl1.cbxCostcenter.SelectedItem != null)
                {
                    ObjTmp s = (ObjTmp)this.headerControl1.cbxCostcenter.SelectedItem;
                    objContract.CostCenter = findclsBaseListItem(s.strValue1, this.costCenterList);
                    //MessageBox.Show(s.value);
                }
            }

            if (this.headerControl1.cbxResponsibleSite.SelectedIndex >= 0)
            {
                if (this.headerControl1.cbxResponsibleSite.SelectedItem != null)
                {
                    ObjTmp          s    = (ObjTmp)this.headerControl1.cbxResponsibleSite.SelectedItem;
                    clsBaseListItem site = null;
                    site = SCBase.findSite(s.strValue1);
                    if (site != null)
                    {
                        objContract.SiteId = site;
                    }
                    //MessageBox.Show(s.value);
                }
            }

            if (this.headerControl1.cbxValidWorkshop.SelectedIndex >= 0)
            {
                if (this.headerControl1.cbxValidWorkshop.SelectedItem != null)
                {
                    ObjTmp s = (ObjTmp)this.headerControl1.cbxValidWorkshop.SelectedItem;
                    objContract.ValidWorkshopCode = findclsBaseListItem(s.strValue1, this.ws);
                    //MessageBox.Show(s.value);
                }
            }
        }
Пример #7
0
        private void fillDynField()
        {
            cbAn.Checked   = contract.IsBodyIncl;
            cbAu.Checked   = contract.IsCraneIncl;
            cbTai.Checked  = contract.IsTailLiftIncl;
            cbCool.Checked = contract.IsCoolingIncl;

            clsBaseListItem        tmp        = null;
            List <clsBaseListItem> dynFields1 = contractVehicle.dynFields1;
            int count = dynFields1.Count;

            if (count > 0)
            {
                tmp           = dynFields1[0];
                txtMake1.Text = tmp.strValue1;
            }
            if (count > 1)
            {
                tmp          = dynFields1[1];
                txtTyp1.Text = tmp.strValue1;
            }
            if (count > 2)
            {
                tmp            = dynFields1[2];
                txtEmail1.Text = tmp.strValue1;
            }
            if (count > 3)
            {
                tmp         = dynFields1[3];
                txtSr1.Text = tmp.strValue1;
            }

            List <clsBaseListItem> dynFields2 = contractVehicle.dynFields2;

            count = dynFields2.Count;
            if (count > 0)
            {
                tmp           = dynFields2[0];
                txtMake2.Text = tmp.strValue1;
            }
            if (count > 1)
            {
                tmp          = dynFields2[1];
                txtTyp2.Text = tmp.strValue1;
            }
            if (count > 2)
            {
                tmp            = dynFields2[2];
                txtEmail2.Text = tmp.strValue1;
            }
            if (count > 3)
            {
                tmp         = dynFields2[3];
                txtSr2.Text = tmp.strValue1;
            }
            List <clsBaseListItem> dynFields3 = contractVehicle.dynFields3;

            count = dynFields3.Count;
            if (count > 0)
            {
                tmp           = dynFields3[0];
                txtMake3.Text = tmp.strValue1;
            }
            if (count > 1)
            {
                tmp          = dynFields3[1];
                txtTyp3.Text = tmp.strValue1;
            }
            if (count > 2)
            {
                tmp            = dynFields3[2];
                txtEmail3.Text = tmp.strValue1;
            }
            if (count > 3)
            {
                tmp         = dynFields3[3];
                txtSr3.Text = tmp.strValue1;
            }
            List <clsBaseListItem> dynFields4 = contractVehicle.dynFields4;

            count = dynFields4.Count;
            if (count > 0)
            {
                tmp           = dynFields4[0];
                txtMake4.Text = tmp.strValue1;
            }
            if (count > 1)
            {
                tmp          = dynFields4[1];
                txtTyp4.Text = tmp.strValue1;
            }
            if (count > 2)
            {
                tmp            = dynFields4[2];
                txtEmail4.Text = tmp.strValue1;
            }
            if (count > 3)
            {
                tmp         = dynFields4[3];
                txtSr4.Text = tmp.strValue1;
            }
        }
Пример #8
0
        public Contract saveContractData()
        {
            //ContractDate contractDate = contract.ContractDateData;
            //ContractPayment ContractPaymentData = contract.ContractPaymentData;
            //ContractCapital ContractCapitalData = contract.ContractCapitalData;
            //ContractCost ContractCostData = contract.ContractCostData;
            //ContractExtraKm ContractExtraKmData = contract.ContractExtraKmData;

            ContractDate    contractDate        = ContractFrm.objContract.ContractDateData;
            ContractPayment ContractPaymentData = ContractFrm.objContract.ContractPaymentData;
            ContractCapital ContractCapitalData = ContractFrm.objContract.ContractCapitalData;
            ContractCost    ContractCostData    = ContractFrm.objContract.ContractCostData;
            ContractExtraKm ContractExtraKmData = ContractFrm.objContract.ContractExtraKmData;

            if (contractDate == null)
            {
                contractDate = new ContractDate();
            }
            if (ContractPaymentData == null)
            {
                ContractPaymentData = new ContractPayment();
            }
            if (ContractCapitalData == null)
            {
                ContractCapitalData = new ContractCapital();
            }
            if (ContractCostData == null)
            {
                ContractCostData = new ContractCost();
            }
            if (ContractExtraKmData == null)
            {
                ContractExtraKmData = new ContractExtraKm();
            }

            //Start
            contractDate.ContractStartDate   = txtStartDate.Value;
            contractDate.ContractStartKm     = Int32.Parse(txtStartKm.Value.ToString());
            contractDate.ContractStartHour   = Int32.Parse(txtStartHr.Value.ToString());
            contractDate.InvoiceStartDate    = txtStartInvoice.Value;
            contractDate.ContractPeriodMonth = Int32.Parse(txtPeriod.Text);
            contractDate.ContractPeriodKm    = Int32.Parse(txtKm.Value.ToString());
            contractDate.ContractPeriodHour  = Int32.Parse(txtHr.Value.ToString());


            if (rdKmBase.Checked)
            {
                ContractFrm.objContract.ContractDateData.ContractPeriodKmHour = 1;
            }
            if (rdHrBase.Checked)
            {
                ContractFrm.objContract.ContractDateData.ContractPeriodKmHour = 2;
            }

            //End
            contractDate.ContractEndDate = txtEndDate.Value;
            contractDate.ContractEndKm   = Int32.Parse(txtEndKm.Value.ToString());
            contractDate.ContractEndHour = Int32.Parse(txtEndHr.Value.ToString());
            contractDate.InvoiceEndDate  = txtEndInvoice.Value;

            if (cbTemType.SelectedValue != null)
            {
                clsBaseListItem TerminationType = new clsBaseListItem();
                TerminationType.strValue1 = cbTemType.SelectedValue.ToString();
                TerminationType.strText   = cbTemType.SelectedText;
                ContractFrm.objContract.TerminationType = TerminationType;
            }

            //Payment
            if (cbPayPeriod.SelectedValue != null)
            {
                clsBaseListItem PaymentPeriod = new clsBaseListItem();
                PaymentPeriod.strValue1           = cbPayPeriod.SelectedValue.ToString();
                PaymentPeriod.strText             = cbPayPeriod.SelectedText;
                ContractPaymentData.PaymentPeriod = PaymentPeriod;
            }


            ContractFrm.objContract.IsManualInvoice = cbInvoice.Checked;
            ContractPaymentData.PaymentIsInBlock    = cbPayment.Checked;

            if (cbColType.SelectedValue != null)
            {
                ContractPaymentData.PaymentCollectionType = cbColType.SelectedValue.ToString();
            }
            if (cbGrpLevel.SelectedValue != null)
            {
                ContractPaymentData.PaymentGroupingLevel = cbGrpLevel.SelectedValue.ToString();
            }
            clsBaseListItem PaymentTerm = new clsBaseListItem();

            if (cbPayTerm.SelectedValue != null)
            {
                PaymentTerm.strValue1 = cbPayTerm.SelectedValue.ToString();
                PaymentTerm.strText   = cbPayTerm.SelectedText;
            }
            ContractPaymentData.PaymentTerm = PaymentTerm;

            clsBaseListItem InvoiceSiteId = new clsBaseListItem();

            if (cbInvoiceSite.SelectedValue != null)
            {
                InvoiceSiteId.strValue1 = cbInvoiceSite.SelectedValue.ToString();
                InvoiceSiteId.strText   = cbInvoiceSite.SelectedText;
            }
            ContractFrm.objContract.InvoiceSiteId = InvoiceSiteId;


            //captial
            ContractCapitalData.CapitalStartAmount = txtStartAmount.Value;
            clsBaseListItem CapitalStartPayer = new clsBaseListItem();

            if (txtStartAmountPayer.SelectedValue != null)
            {
                CapitalStartPayer.strValue1 = txtStartAmountPayer.SelectedValue.ToString();
                CapitalStartPayer.strText   = txtStartAmountPayer.SelectedText.ToString();
            }
            ContractCapitalData.CapitalStartPayer = CapitalStartPayer;

            ContractCapitalData.CapitalMonthAmount = txtMonAmount.Value;

            clsBaseListItem CapitalMonthPayer = new clsBaseListItem();

            if (txtMonAmountPayer.SelectedValue != null)
            {
                CapitalMonthPayer.strValue1 = txtMonAmountPayer.SelectedValue.ToString();
                CapitalMonthPayer.strText   = txtMonAmountPayer.SelectedText.ToString();
            }
            ContractCapitalData.CapitalMonthPayer = CapitalMonthPayer;

            if (ContractFrm.objContract.ContractCapitalData != null)
            {
                txtTotalAmount.Text = (ContractFrm.objContract.ContractCapitalData.CapitalStartAmount
                                       + ContractFrm.objContract.ContractCapitalData.CapitalMonthAmount * ContractFrm.objContract.ContractDateData.ContractPeriodMonth).ToString();
            }
            else
            {
                txtTotalAmount.Text = "";
            }

            //Cost
            clsBaseListItem CostBasis = new clsBaseListItem();

            if (cbCostBassis.SelectedValue != null)
            {
                CostBasis.strValue1 = cbCostBassis.SelectedValue.ToString();
                CostBasis.strText   = cbCostBassis.SelectedText.ToString();
            }
            ContractCostData.CostBasis = CostBasis;

            ContractCostData.CostBasedOnService = txtCostBase.Value;
            ContractCostData.CostMonthBasis     = txtMonBassis.Value;
            ContractCostData.CostKmBasis        = txtKmBassis.Value;
            ContractCostData.CostPerKm          = txtErr.Value;
            txtLastPay.Text = "txtLastPay";
            txtLastKm.Text  = "";

            //Extra

            clsBaseListItem ExtraKmInvoicePeriod = new clsBaseListItem();

            if (cbBiling.SelectedValue != null)
            {
                ExtraKmInvoicePeriod.strValue1 = cbBiling.SelectedValue.ToString();
                ExtraKmInvoicePeriod.strText   = cbBiling.SelectedText.ToString();
            }
            ContractExtraKmData.ExtraKmInvoicePeriod = ExtraKmInvoicePeriod;

            clsBaseListItem ExtraKmAccounting = new clsBaseListItem();

            if (cbAccounting.SelectedValue != null)
            {
                ExtraKmAccounting.strValue1 = cbAccounting.SelectedValue.ToString();
                ExtraKmAccounting.strText   = cbAccounting.SelectedText.ToString();
            }
            ContractExtraKmData.ExtraKmAccounting     = ExtraKmAccounting;
            ContractExtraKmData.ExtraKmMaxDeviation   = txtMaxDev.Value;
            ContractExtraKmData.ExtraKmLowAmount      = txtLowKm.Value;
            ContractExtraKmData.ExtraKmHighAmount     = txtHighKm.Value;
            ContractExtraKmData.ExtraKmInvoicedAmount = txtInvoiceAmount.Value;

            //
            clsBaseListItem RollingCode = new clsBaseListItem();

            if (cbRoll.SelectedIndex >= 0)
            {
                RollingCode.strValue1 = cbRoll.SelectedValue.ToString();
                RollingCode.strText   = cbRoll.SelectedText.ToString();
            }
            ContractFrm.objContract.RollingCode = RollingCode;

            ContractFrm.objContract.IsInvoiceDetail = cbInvoiceDetail.Checked;

            //RiskCustId

            ContractCustomer RiskCustId = new ContractCustomer();

            if (txtRiskCusId.Text != null && txtRiskCusId.Text.Trim().Length > 0)
            {
                RiskCustId.CustId = Int32.Parse(txtRiskCusId.Text);
            }
            ContractFrm.objContract.RiskCustId = RiskCustId;
            ContractFrm.objContract.RiskLevel  = txtRishLevel.Value;



            //Save Risk
            List <ZSC_SubcontractorContractRisk> listRisk     = new List <ZSC_SubcontractorContractRisk>();
            List <SubContractorContract>         SubContracts = ContractFrm.objContract.SubContracts;

            ZSC_SubcontractorContractRisk objRisk = null;
            string  colName = "";
            decimal newInteger;

            foreach (DataRow row in dataTable.Rows)
            {
                foreach (SubContractorContract subContract in SubContracts)
                {
                    colName = "sub" + subContract.OID;
                    if (row[colName] != null && row[colName].ToString().Trim().Length > 0 &&
                        decimal.TryParse(row[colName].ToString().Trim(), out newInteger) && newInteger > 0)
                    {
                        objRisk = new ZSC_SubcontractorContractRisk();
                        objRisk.SubContractOID    = subContract.OID;
                        objRisk.RiskPartnerCustId = Int32.Parse(row["RiskPartnerCustId"].ToString().Trim());
                        objRisk.RiskLevel         = decimal.Parse(row[colName].ToString().Trim());
                        listRisk.Add(objRisk);
                    }
                }
            }
            ContractFrm.objContract.SubcontractorContractRisks = listRisk;
            ContractFrm.objContract.ContractDateData           = contractDate;
            ContractFrm.objContract.ContractPaymentData        = ContractPaymentData;
            ContractFrm.objContract.ContractCapitalData        = ContractCapitalData;
            ContractFrm.objContract.ContractCostData           = ContractCostData;
            ContractFrm.objContract.ContractExtraKmData        = ContractExtraKmData;

            ContractFrm.objContract.IndexingDate = dtIndexingDate.Value;
            ContractFrm.objContract.IndexValue   = dfIndexValue.Value;
            ContractFrm.objContract.ContractPaymentData.InvoiceDate = (Int32)dfInvoicingDay.Value;
            return(ContractFrm.objContract);
        }