Esempio n. 1
0
        private void ShowQuotaInvoice()
        {
            cn = GetSGBDConnection();
            cn.Open();
            if (currentQuotaInvoice != -1)
            {
                foreach (Quota_Invoice q in quotaList)
                {
                    if (q.Index == currentQuotaInvoice)
                    {
                        id_f_quotas = q.ID;
                        //Show Quota invoice textboxes
                        ShowQuotaInvTB();
                        //Show Quota Buttons
                        Delete_Quota_button.Show();


                        cmd = new SqlCommand("condomanager.ispaidquotas", cn)
                        {
                            CommandType = CommandType.StoredProcedure
                        };

                        cmd.Parameters.AddWithValue("id_fatura", q.ID);
                        cmd.ExecuteNonQuery();
                        DataTable      dt = new DataTable();
                        SqlDataAdapter da = new SqlDataAdapter(cmd);
                        da.Fill(dt);

                        Date_input_Quota_Invoice_textBox.Text      = q.Date;
                        TaxNumber_input_Quota_Invoice_textBox.Text = q.Tax_Number;
                        Amount_input_Quota_Invoice_textBox.Text    = q.Amount;
                        Ref_input_Quota_Invoice_textBox.Text       = q.ref_fracao;
                        Desc_input_Quota_Invoice_textBox.Text      = q.Description;

                        Date_Quota_Invoice_textBox.Show();
                        TaxNumber_Quota_Invoice_textBox.Show();
                        Amount_Quota_Invoice_textBox.Show();
                        Ref_Quota_Invoice_textBox.Show();
                        Desc_Quota_Invoice_textBox.Show();
                        Invoice_Quota_textBox.Show();
                        if (dt.Rows.Count != 0)
                        {
                            //payment
                            Payment_Quota_textBox.Show();
                            Date_Quota_Payment_textBox.Show();
                            Date_input_Quota_Payment_textBox.Show();
                            Desc_Quota_Payment_textBox.Show();
                            Desc_input_Quota_Payment_textBox.Show();
                            // add payment values
                            Date_input_Quota_Payment_textBox.Text = dt.Rows[0]["data"].ToString();
                            Desc_input_Quota_Payment_textBox.Text = dt.Rows[0]["descricao"].ToString();
                            Mark_Paid_Quota_button.Hide();
                            Add_Quota_button.Hide();
                        }
                        else
                        {
                            //payment
                            Payment_Quota_textBox.Hide();
                            Date_Quota_Payment_textBox.Hide();
                            Date_input_Quota_Payment_textBox.Hide();
                            Desc_Quota_Payment_textBox.Hide();
                            Desc_input_Quota_Payment_textBox.Hide();
                            Mark_Paid_Quota_button.Show();
                            Add_Quota_button.Hide();
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        private void ShowServiceInvoice()
        {
            if (currentServiceInvoice != -1)
            {
                foreach (Service_Invoice sp in spList)
                {
                    if (sp.Index == currentServiceInvoice)
                    {
                        id_f_sp = sp.ID;
                        //Show Service invoice textboxes
                        ShowServiceInvTB();
                        //Show Service Buttons
                        Delete_Service_button.Show();

                        VerifySGBDConnection();

                        cmd = new SqlCommand("condomanager.ispaidservicos", cn)
                        {
                            CommandType = CommandType.StoredProcedure
                        };

                        cmd.Parameters.AddWithValue("id_fatura", sp.ID);
                        cmd.ExecuteNonQuery();
                        DataTable      dt = new DataTable();
                        SqlDataAdapter da = new SqlDataAdapter(cmd);
                        da.Fill(dt);

                        Date_input_Service_Invoice_textBox.Text      = sp.Date;
                        TaxNumber_input_Service_Invoice_textBox.Text = sp.Tax_Number;
                        Amount_input_Service_Invoice_textBox.Text    = sp.Amount;
                        Desc_input_Service_Invoice_textBox.Text      = sp.Description;

                        ShowServiceInvTB();
                        if (dt.Rows.Count != 0)
                        {
                            //payment
                            Payment_Service_textBox.Show();
                            Date_Service_Payment_textBox.Show();
                            Date_input_Service_Payment_textBox.Show();
                            Desc_Service_Payment_textBox.Show();
                            Desc_input_Service_Payment_textBox.Show();
                            //add payment values
                            Date_input_Service_Payment_textBox.Text = dt.Rows[0]["data"].ToString();
                            Desc_input_Service_Payment_textBox.Text = dt.Rows[0]["descricao"].ToString();
                            Mark_Paid_Quota_button.Show();
                            Add_Quota_button.Hide();
                        }
                        else
                        {
                            //payment
                            Payment_Service_textBox.Hide();
                            Date_Service_Payment_textBox.Hide();
                            Date_input_Service_Payment_textBox.Hide();
                            Desc_Service_Payment_textBox.Hide();
                            Desc_input_Service_Payment_textBox.Hide();
                            Mark_Paid_Service_button.Show();
                        }
                    }
                }
            }
        }