Prix TTC

Forum consacré aux développements d'applications interfacées avec les logiciels Sage

Modérateurs: Super Modérateur, Modérateurs

Règles du forum
Merci de prendre connaissance des règles d'utilisation du forum

Avant de poster un nouveau message, utilisez la fonction RECHERCHER. Indiquez la VERSION de votre logiciel et toutes informations utiles à la résolution de votre question. Ne rédigez pas vos messages en MAJUSCULES. Soyez courtois et pensez aux formules de POLITESSE d'usage. Les messages à vocation COMMERCIALE ou PUBLICITAIRE seront supprimés.

*** LORSQU'UN SUJET EST RESOLU, SON AUTEUR DOIT EDITER LE 1ER MESSAGE DU SUJET EN HAUT DE PAGE ET COCHER "SUJET RESOLU" ***

Prix TTC

Messagede iheb1985 » Mer 13 Juil 2011 10:57

bonjour,
j'essaye d'interroger la base du fameux logiciel SAGE mais je rencontre un problème car un produit possède un Prix de vente HT et appartient a une famille s'il a le même taxe de sa famille alors le code taxe s'enregistre dans une table nommée famcompta si nn dans une table nommé artcompta, je veux collecter les ses informations j'ai résussi à écrire un bout de code qui me fait ça mais je veux l'intégrer dans un autre code qui m'affiche tous les info du produits:

code 1:
Code: Tout sélectionner
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If (TextBox1.Text = "") Then
            MsgBox("Please Enter The Code")
        Else

            cnx.ConnectionString = chaine
            Try
                cnx.Open()
                Dim cmd As New SqlCommand("select [ACP_ComptaCPT_Taxe1],[AR_PrixVen] From [F_ARTCOMPTA],[F_ARTICLE] where [F_ARTCOMPTA].[AR_Ref] =  '" & TextBox1.Text & "' AND [F_ARTICLE].[AR_Ref]=[F_ARTCOMPTA].[AR_Ref]", cnx)
                Dim reader As SqlDataReader
                reader = cmd.ExecuteReader()
                If reader.HasRows Then
                    While reader.Read()

                        If (reader(0) = "C00") Then
                            MsgBox(reader(1))
                        ElseIf (reader(0) = "C18") Then
                            MsgBox(CDbl((reader(1)) * 1.18))
                        End If
                   
                    End While
                Else
                    reader.Close()
                    Dim cmdd As New SqlCommand("select [F_FAMCOMPTA].[FA_CodeFamille],[FCP_ComptaCPT_Taxe1],[AR_PrixVen] From [F_FAMCOMPTA],[F_ARTICLE] where [F_ARTICLE].[AR_Ref] =  '" & TextBox1.Text & "' AND [F_ARTICLE].[FA_CodeFamille]=[F_FAMCOMPTA].[FA_CodeFamille]", cnx)
                    Dim readers As SqlDataReader
                    readers = cmdd.ExecuteReader()
                    While readers.Read
                        If (readers(1) = "C00") Then
                            MsgBox(readers(2))
                        ElseIf (readers(1) = "C18") Then
                            MsgBox(Val((readers(2)) * 1.18))
                        End If
                    End While
                End If
            Catch ex As Exception
                MsgBox(ex.Message, MsgBoxStyle.Critical)
            End Try
            cnx.Close()
        End If
    End Sub







code 2:
Code: Tout sélectionner
Public Sub box1_changed()
        If (Form1.TextBox1.Text = "") Then
            Form1.myDataGridView.Rows.Clear()
            Form1.Button1.Enabled = False
            Form1.Button2.Enabled = False
            Form1.Button3.Enabled = False
        Else
            Form1.myDataGridView.Rows.Clear()
            cnx.ConnectionString = chaine
            Form1.Button1.Enabled = True
            Form1.Button2.Enabled = True
            Form1.Button3.Enabled = True
            Try
                cnx.Open()
                Dim cmd As New SqlCommand("select F_ARTICLE.[AR_Ref],[Emplacement],[AR_Design],[AR_PrixVen],[PrixPublic],[CodePCT],[Carton],[AS_QteSto] from F_ARTICLE,F_ARTSTOCK where [AR_Design] like  '" & Form1.TextBox1.Text & "%' AND [F_ARTSTOCK].[AR_Ref]=[F_ARTICLE].[AR_Ref] ", cnx)
                Dim reader As SqlDataReader
                reader = cmd.ExecuteReader()

                While reader.Read()
                    Dim n As Integer = Form1.myDataGridView.Rows.Add()
                    Form1.myDataGridView.Rows.Item(n).Cells(0).Value = reader(0)
                    Form1.myDataGridView.Rows.Item(n).Cells(1).Value = reader(1).ToString
                    Form1.myDataGridView.Rows.Item(n).Cells(2).Value = reader(2)
                    Form1.myDataGridView.Rows.Item(n).Cells(3).Value = Format(reader(3), "0.000")
                    Form1.myDataGridView.Rows.Item(n).Cells(4).Value = Format(reader(4), "0.000")
                    Form1.myDataGridView.Rows.Item(n).Cells(5).Value = reader(5)
                    Form1.myDataGridView.Rows.Item(n).Cells(6).Value = CDbl(reader(6))
                    Form1.myDataGridView.Rows.Item(n).Cells(7).Value = CDbl(reader(7))

                End While

            Catch ex As Exception
                MsgBox(ex.Message, MsgBoxStyle.Critical)
            End Try
        End If
        cnx.Close()
    End Sub






le prix TTC doit normalement être intégrer dans le code 2 et il s'affiche dans la cellule numéro 3
iheb1985
Posteur néophyte
Posteur néophyte
 
Messages: 1
Inscription: Mar 12 Juil 2011 19:47

Retourner vers Développements ODBC, Objets métiers, SQL

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 0 invités