示例#1
0
        private void refreshTartims()
        {
            button1.Enabled = false;

            dgMain.Rows.Clear();

            getTartims();
            if (tartims == null || tartims.Length <= 0)
            {
                button1.Enabled = true;
                return;
            }

            for (int n = 0; n < tartims.Length; n++)
            {
                dgMain.Rows.Add();
                dgMain.Rows[n].Cells["SUREC"].Value = Tartim.getScenarioText(tartims[n].scenario);
                dgMain.Rows[n].Cells["ERDA1"].Value = tartims[n].firstWeightDate;
                dgMain.Rows[n].Cells["TRAID"].Value = tartims[n].plateNumber.ToString();
                if (tartims[n].counterParty != null)
                {
                    dgMain.Rows[n].Cells["NAME1_TR"].Value = tartims[n].counterParty.ToString();
                }
                dgMain.Rows[n].Cells["NETAG"].Value    = tartims[n].netWeight.getWeight();
                dgMain.Rows[n].Cells["MAKTX_TR"].Value = tartims[n].material.ToString();
                dgMain.Rows[n].Cells["BITTI"].Value    = tartims[n].isOver ? ilMain.Images[5] : ilMain.Images[6];
                dgMain.Rows[n].Cells["SAPAK"].Value    = tartims[n].transferredToSAP ? ilMain.Images[5] : ilMain.Images[6];
            }


            button1.Enabled   = true;
            btnPrint.Enabled  = true;
            btnPrint2.Enabled = true;
            btnDelete.Enabled = true;
            btnEdit.Enabled   = true;
        }
示例#2
0
        public FormEdit(Tartim T)
        {
            InitializeComponent();

            // Tartým
            tartim = T;
            tartim.deliveryUpperBoundExceeded += new Tartim.DeliveryUpperBoundExceededDelegate(tartim_deliveryUpperBoundExceeded);

            // Ana verileri çekelim
            if (tartim.scenario == Tartim.SCENARIO.PURCHASING)
            {
                counterParties = Counterparty.getAllVendors(Counterparty.VENDOR_TYPE.VENDOR);
            }
            else
            {
                counterParties = Counterparty.getAll(Counterparty.TYPE.CLIENT);
            }

            transporters = Counterparty.getAllVendors(Counterparty.VENDOR_TYPE.TRANSPORTER);
            materials    = Material.getAll(tartim.scenario);

            // Formu dolduralým
            txtBag.Text   = tartim.bagCount.ToString();
            txtDate1.Text = tartim.firstWeightDate.ToShortDateString();
            if (tartim.isOver)
            {
                txtDate2.Text = tartim.secondWeightDate.ToShortDateString();
            }
            txtDrive.Text = tartim.driver;
            txtFree.Text  = tartim.notes;
            txtFrom.Text  = tartim.areaFrom;
            txtID.Text    = tartim.weightId.ToString();
            txtMubel.Text = tartim.counterPartyDocumentNumber;
            if (tartim.isOver)
            {
                txtNetWeight.Text = tartim.netWeight.getWeight().ToString();
            }
            txtOpera.Text     = tartim.employee;
            txtScenario.Text  = Tartim.getScenarioText(tartim.scenario);
            txtSteelYard.Text = tartim.steelyard.ToString();
            txtTo.Text        = tartim.areaTo;
            txtWeight1.Text   = tartim.firstWeight.getWeight().ToString();
            if (tartim.isOver)
            {
                txtWeight2.Text = tartim.secondWeight.getWeight().ToString();
                txtWtextAR.Text = tartim.weightTextAR;
            }
            plateMain.plateNumber = tartim.plateNumber;
            if (tartim.document != null)
            {
                plateMain.Enabled = false;
            }

            for (int n = 0; n < counterParties.Length; n++)
            {
                cmbParty.Items.Add(counterParties[n].ToString());
                if (counterParties[n].id == tartim.counterParty.id)
                {
                    cmbParty.SelectedIndex = n;
                }
            }

            for (int n = 0; n < transporters.Length; n++)
            {
                cmbTransporter.Items.Add(transporters[n].ToString());
                if (tartim.transporter != null && transporters[n].id == tartim.transporter.id)
                {
                    cmbTransporter.SelectedIndex = n;
                }
            }

            for (int n = 0; n < materials.Length; n++)
            {
                cmbMaterial.Items.Add(materials[n].ToString());
                if (materials[n].id == tartim.material.id)
                {
                    cmbMaterial.SelectedIndex = n;
                }
            }

            // Belge olayý
            switch (tartim.scenario)
            {
            case Tartim.SCENARIO.PURCHASING:
                cmbDocument.Enabled = false;
                break;

            case Tartim.SCENARIO.SALES:
                if (tartim.hasDocument)
                {
                    cmbDocument.Items.Add(tartim.document.ToString());
                    cmbDocument.SelectedIndex = 0;

                    tartimCandidates = Tartim.getTartims(plateMain.plateNumber);
                    if (tartimCandidates == null)
                    {
                        cmbDocument.Enabled = false;
                    }
                    else
                    {
                        cmbDocument.Enabled = true;
                        for (int n = 0; n < tartimCandidates.Length; n++)
                        {
                            cmbDocument.Items.Add(tartimCandidates[n].document.ToString());
                        }
                    }

                    cmbParty.Enabled       = false;
                    cmbTransporter.Enabled = false;
                    cmbMaterial.Enabled    = false;
                    documentEventsEnabled  = true;
                }
                else
                {
                    cmbDocument.Enabled = false;
                }
                break;
            }

            // SAP'ye aktarýldýysa iyice kýsýtlayacaðýz
            if (tartim.transferredToSAP)
            {
                cmbDocument.Enabled    = false;
                cmbMaterial.Enabled    = false;
                cmbParty.Enabled       = false;
                cmbTransporter.Enabled = false;
                btnSave.Enabled        = false;
                txtBag.Enabled         = false;
                txtDrive.Enabled       = false;
                txtFree.Enabled        = false;
                txtFrom.Enabled        = false;
                txtTo.Enabled          = false;
                txtFree.Enabled        = false;
                txtMubel.Enabled       = false;
                txtOpera.Enabled       = false;
                txtWtextAR.Enabled     = false;
                plateMain.Enabled      = false;
            }
        }