Skip to content

Documents

In Bcpro all orders, invoices,... are saved in documents.

REST API

GET /document
GET /documents
POST /document

GraphQL

query {
  document {
    doc {
      TYP
    }
  }
}
query {
  documents {
    doc {
      TYP
    }
  }
}
mutation {
  document(doc: { type: F, journal: "FACZ" }) {
    doc {
      TYP
    }
  }
}

Return

GET /document

{
  "data": {
    "TYP": "A"
  }
}

GET /documents

{
  "data": {
    "documents": [
      {
        "TYP": "A"
      },
      {
        "TYP": "V"
      },
		...
    ]
  }
}

POST /document

{
  "data": {
    "document": {
      "doc": {
        "TYP": "F"
      }
    }
  }
}

The Document Return Object

{
  "data": {
    "document": {
      "doc": {
        "ADR": "Musteradresse 1",
        "ADR2": " ",
        "ADR3": " ",
        "ANNEE": 21,
        "ANNEE_DEVIS": 0,
        "CDP": "12345",
        "CDP2": " ",
        "CDP3": " ",
        "COD_CLI": "f8c7e1c90b",
        "COD_FOU": " ",
        "CODES_BLOCAGE": " ",
        "CRS": 1,
        "DAT_DOC": "2022-03-04T00:00:00.000Z",
        "DAT_EXIG_TVA": "0001-01-01T00:00:00.000Z",
        "DAT_FACTURE": "0001-01-01T00:00:00.000Z",
        "DAT_MODIF_CV": "0001-01-01T00:00:00.000Z",
        "DAT_PAYE": "0001-01-01T00:00:00.000Z",
        "DAT_TERMINE": "0001-01-01T00:00:00.000Z",
        "DEV": "EUR",
        "ESC": 0,
        "FACTURE": " ",
        "FAX": " ",
        "GA": " ",
        "HH_MM": 10.49,
        "JOURNAL": "FACT",
        "JOURNAL_DEVIS": " ",
        "LGUE": "F",
        "LIVR_DESIREE": "0001-01-01T00:00:00.000Z",
        "LIVRE": " ",
        "LST_PRIX": " ",
        "MOD_PAIE": "1",
        "MT_ESC": 0,
        "NBR_EXEMPLAIRE": 1,
        "NBR_JRS": 0,
        "NBR_LIGNE": 98304,
        "NOM": "Max Mustermann",
        "NOM2": " ",
        "NOM3": " ",
        "NUM_ADR": 0,
        "NUM_DEVIS": " ",
        "NUM_DOC": 49,
        "OPT1": " ",
        "OPT2": " ",
        "OPT3": " ",
        "OPT4": " ",
        "PAYE": " ",
        "PV123": "1",
        "PY": "DE",
        "PY2": " ",
        "PY3": " ",
        "QUI_A_FACTURE": " ",
        "QUI_A_TERMINE": " ",
        "REF": " ",
        "REIMPRIMER": "O",
        "REPORT_TVA": " ",
        "SECTEUR": "1",
        "TARIF": " ",
        "TEL": " ",
        "TERMINE": " ",
        "TOTAL_DOC_HTVA": 20,
        "TOTAL_DOC_TVAC": 24.2,
        "TOTAL_FACTURE": 0,
        "TOTAL_IMPRIME": 0,
        "TOTAL_PAYE": 0,
        "TVA": " ",
        "TYP": "F",
        "TYP_CLI": "N",
        "VALID_ESC": 0,
        "VENDEUR_COLLAB": "PC",
        "VIL": "Musterstadt",
        "VIL2": " ",
        "VIL3": " "
      },
      "client": {
        "ADR": "Musteradresse 1",
        "CDP": "12345",
        "COD": "00001",
        "E_MAIL": "max@mustermann.de",
        "ENTE": "MR",
        "LGUE": "D",
        "NOM": "Max Mustermann",
        "NOM2": " ",
        "PY": "DE",
        "TEL1": "0478/123.456",
        "TEL2": " ",
        "TYP_INTERV": " ",
        "VIL": "Musterstadt"
      },
      "item": {
        "art": [
          {
            "TYP": "F",
            "JOURNAL": "FACT",
            "ANNEE": 21,
            "NUM_DOC": 49,
            "NUM_LIG": 32768,
            "CATEG": "PV base art.",
            "COD": "0000000001",
            "COD_CMDE_FOU": " ",
            "COD_FACTURE": "F",
            "COD_FOU": "00001",
            "COD_LIVRE": "L",
            "COD_TVA": "21",
            "CRS_DEV_PA": 1,
            "DESI": "T-SHIRT Blau",
            "DEV_PA": "EUR",
            "GA": "VEN",
            "INFO": " ",
            "INT_A_FACTURER": " ",
            "INT_HH": 0,
            "INT_MM": 0,
            "INT_NBR_KMS": 0,
            "INT_NUM_LIG_TRA": 0,
            "LIB1": "T-SHIRT Blau",
            "LIB2": " ",
            "MESU": "P",
            "MODIFIE": " ",
            "NUM_STOCK": "1",
            "PA_BRUT_U_E_A": 15,
            "PA_COMMIS_VEND": 0,
            "PA_NET_U_E_A": 14,
            "PANUL_CONFIRME": " ",
            "PV_BRUT": 20,
            "PV_BRUT_COMMIS": 0,
            "PV_COMMIS_VEND": 0,
            "PV_U_E_V": 20,
            "PVNUL_CONFIRME": "X",
            "QTE_RETOUR": 0,
            "QTE_U_E_A": 1,
            "QTE_U_E_V": 1,
            "REF_FOU": " ",
            "REMISE_MAX_CV": -20,
            "REMISE1": 4.2,
            "REMISE2": 2.6,
            "SUP_RAB_U_E_V": 0,
            "TVA_ACH": " ",
            "U_E_A": 1,
            "U_E_V": 1
          }
        ],
        "lig": [
          {
            "TYP": "F",
            "JOURNAL": "FACT",
            "ANNEE": 21,
            "NUM_DOC": 49,
            "NUM_LIG": 32768,
            "TYP_DOC_ART": "F",
            "JOURNAL_DOC_ART": "FACT",
            "ANNEE_DOC_ART": 21,
            "NUM_DOC_DOC_ART": 49,
            "NUM_LIG_DOC_ART": 32768,
            "COD_ART": "0000000001",
            "COD_STOCK": "S",
            "DAT_DOC": "2022-03-04T00:00:00.000Z",
            "DAT_MVT": "2022-03-04T00:00:00.000Z",
            "LIG_DEV_BLOQUEE": " ",
            "LIVRAISON": "0001-01-01T00:00:00.000Z",
            "QTE_ANNUL_U_E_A": 0,
            "QTE_RECUE_U_E_A": 0,
            "SAUT_PAGE_AVANT": " ",
            "VARIANTE": " "
          }
        ]
      }
    }
  }
}

The Document Create Object

Important fields

  • doc object
    • type string(1)
      The type of the document. (journals)
    • journal string(20)
      The journal of the document. (journals)
    • client object
      • code string(10)
        Code
      • name string(40)
        Full name
      • email string(60)
        Email
      • phone string(25)
        Phone
      • name string(40)
        Name
      • address string(60)
        Address
      • city string(35)
        City
      • zip string(6)
        Postal code
      • countryCode string(3)
        Country Code
    • billingAddress object
      • name string(40)
        Name
      • address string(60)
        Address
      • city string(35)
        City
      • zip string(6)
        Postal code
      • countryCode string(3)
        Country Code
    • shippingAddress object
      • name string(40)
        Name
      • address string(60)
        Address
      • city string(35)
        City
      • zip string(6)
        Postal code
      • countryCode string(3)
        Country Code
  • items array
    • item object
      • code string(20)
        Article code (articles)
      • quantity integer
        Quantity

How to create a document.

We need to tell Bc-Pro what type of document we want to create.

This case: doc: { type: F, journal: "FACZ" }
All available journals

We also need to add at least one item.
This case: items: [{ code: "001", quantity: 1 }]
All available items

This is the minimum requirement to create a document.

Adding a client object will create a new client in Bc-Pro. (Except a client already exists with the same email address)

The stock for added items is adjusted automatically depending on the type of the document.
See journals for all types.
Type F will reduce the Stock by 1. (STOCK1) in articles
Type C will increase the reserved Stock by 1. (STOCK_RESERVE1) in articles

Examples

GraphQL

mutation {
  document(
    doc: { type: F, journal: "FACZ" }
    items: [{ code: "001", quantity: 1 }]
  ) {
    doc {
      TYP
      JOURNAL
      ANNEE
      NUM_DOC
    }
    client {
      E_MAIL
    }
    item {
      lig {
        COD_ART
      }
      art {
        COD
      }
    }
  }
}