1. ask phase: business task

il s’agit d’avoir une vue d’ensemble sur les données commerciales de l’entreprise. l’objectif est de présenter les grandes tendances et proposer des recommandations pour le developpement de la compagnie. les parties prenantes sont: ADG et toutes les chefs de departements. plusieurs questions pourront etre posées: combien y a t’il de commereciaux ou de magasins? combien de clients ont été servis sur la période? quel est la consommation moyenne d’un client? quel est le panier moyen?

2. prepare phase: description of dataset

ROCCC analysis

data collection

les fichiers suivants seront utilisés pour l’analyse - “mouvement des stocks” - “reglements fournisseurs” - “reglements clients” - ““ventes” - “achats” - “articles” - “tiers”

Process phase

l’objectif ici est de nettoyer les données pour les analyser. on utilisera Excel pour le nettoyage et la mise en forme d’une partie des informations. ## importation des librairies

library(plyr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plyr':
## 
##     arrange, count, desc, failwith, id, mutate, rename, summarise,
##     summarize
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(tidyr)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats   1.0.0     ✔ readr     2.1.5
## ✔ ggplot2   3.5.1     ✔ stringr   1.5.1
## ✔ lubridate 1.9.3     ✔ tibble    3.2.1
## ✔ purrr     1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::arrange()   masks plyr::arrange()
## ✖ purrr::compact()   masks plyr::compact()
## ✖ dplyr::count()     masks plyr::count()
## ✖ dplyr::desc()      masks plyr::desc()
## ✖ dplyr::failwith()  masks plyr::failwith()
## ✖ dplyr::filter()    masks stats::filter()
## ✖ dplyr::id()        masks plyr::id()
## ✖ dplyr::lag()       masks stats::lag()
## ✖ dplyr::mutate()    masks plyr::mutate()
## ✖ dplyr::rename()    masks plyr::rename()
## ✖ dplyr::summarise() masks plyr::summarise()
## ✖ dplyr::summarize() masks plyr::summarize()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggplot2)
library(lubridate)
library(plotly)
## 
## Attaching package: 'plotly'
## 
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## 
## The following objects are masked from 'package:plyr':
## 
##     arrange, mutate, rename, summarise
## 
## The following object is masked from 'package:stats':
## 
##     filter
## 
## The following object is masked from 'package:graphics':
## 
##     layout
library(corrplot)
## corrplot 0.94 loaded
library(ggcorrplot)
library(formattable)
## 
## Attaching package: 'formattable'
## 
## The following object is masked from 'package:plotly':
## 
##     style
library(ggrepel)
library(ggpubr)
## 
## Attaching package: 'ggpubr'
## 
## The following object is masked from 'package:plyr':
## 
##     mutate
library(readxl)
library(stringr)
library(highcharter)
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
library(scales)
## 
## Attaching package: 'scales'
## 
## The following objects are masked from 'package:formattable':
## 
##     comma, percent, scientific
## 
## The following object is masked from 'package:purrr':
## 
##     discard
## 
## The following object is masked from 'package:readr':
## 
##     col_factor
library(Hmisc)
## 
## Attaching package: 'Hmisc'
## 
## The following object is masked from 'package:plotly':
## 
##     subplot
## 
## The following objects are masked from 'package:dplyr':
## 
##     src, summarize
## 
## The following objects are masked from 'package:plyr':
## 
##     is.discrete, summarize
## 
## The following objects are masked from 'package:base':
## 
##     format.pval, units

importation des données

ventes <- read_excel('/Users/sergesfokou/Documents/BIG DATA LEARNING/projets pour portfolio/mama sarl/ventes.xlsx')
achats <- read_excel('/Users/sergesfokou/Documents/BIG DATA LEARNING/projets pour portfolio/mama sarl/achats.xlsx')
rglt_fnrs <- read_excel('/Users/sergesfokou/Documents/BIG DATA LEARNING/projets pour portfolio/mama sarl/rglt fnrs.xlsx')
rglt_clients <- read_excel('/Users/sergesfokou/Documents/BIG DATA LEARNING/projets pour portfolio/mama sarl/rglt client.xlsx')
stk <- read_excel('/Users/sergesfokou/Documents/BIG DATA LEARNING/projets pour portfolio/mama sarl/mvts stk.xlsx')
article <- read_excel('/Users/sergesfokou/Documents/BIG DATA LEARNING/projets pour portfolio/mama sarl/articles.xlsx')
tiers <- read_excel('/Users/sergesfokou/Documents/BIG DATA LEARNING/projets pour portfolio/mama sarl/tiers.xlsx')
## Warning: Expecting logical in E1866 / R1866C5: got 'CLIENT'
## Warning: Expecting logical in E2080 / R2080C5: got 'FILTREUR'
## Warning: Expecting logical in E2154 / R2154C5: got 'FOURNISSEUR'
## Warning: Expecting logical in E2155 / R2155C5: got '2'
## Warning: Expecting logical in M2155 / R2155C13: got 'CAMEROUN'
## Warning: Expecting logical in M2158 / R2158C13: got 'CAMEROUN'
## Warning: Expecting logical in E2160 / R2160C5: got 'CLIENT'
## Warning: Expecting logical in M2160 / R2160C13: got 'CAMEROUN'
## Warning: Expecting logical in M2162 / R2162C13: got 'CAMEROUN'
## Warning: Expecting logical in E2163 / R2163C5: got 'CLIENT'
## Warning: Expecting logical in M2163 / R2163C13: got 'CAMEROUN'
## Warning: Expecting logical in E2164 / R2164C5: got 'FOURNISSEUR'
## Warning: Expecting logical in M2164 / R2164C13: got 'CAMEROUN'
## Warning: Expecting logical in M2165 / R2165C13: got 'CAMEROUN'
## Warning: Expecting logical in M2166 / R2166C13: got 'CAMEROUN'
## Warning: Expecting logical in M2167 / R2167C13: got 'CAMEROUN'
## Warning: Expecting logical in M2168 / R2168C13: got 'CAMEROUN'
## Warning: Expecting logical in M2169 / R2169C13: got 'CAMEROUN'
## Warning: Expecting logical in E2170 / R2170C5: got 'POINTEUR DOUALA'
## Warning: Expecting logical in M2170 / R2170C13: got 'CAMEROUN'
## Warning: Expecting logical in E2171 / R2171C5: got 'CLIENT'
## Warning: Expecting logical in M2171 / R2171C13: got 'CAMEROUN'
## Warning: Expecting logical in E2172 / R2172C5: got 'AGENT ENTRETIEN'
## Warning: Expecting logical in M2172 / R2172C13: got 'CAMEROUN'
## Warning: Expecting logical in E2173 / R2173C5: got 'AGENT D'ENTRETIEN'
## Warning: Expecting logical in M2173 / R2173C13: got 'CAMEROUN'
## Warning: Expecting logical in E2174 / R2174C5: got 'CHAUFFEUR'
## Warning: Expecting logical in M2174 / R2174C13: got 'CAMEROUN'
## Warning: Expecting logical in E2175 / R2175C5: got 'MECANICIEN'
## Warning: Expecting logical in M2175 / R2175C13: got 'CAMEROUN'
## Warning: Expecting logical in E2176 / R2176C5: got 'AGENT SECURITE'
## Warning: Expecting logical in M2176 / R2176C13: got 'CAMEROUN'
## Warning: Expecting logical in E2177 / R2177C5: got 'AGENT DE SECURITE'
## Warning: Expecting logical in M2177 / R2177C13: got 'CAMEROUN'
## Warning: Expecting logical in E2178 / R2178C5: got 'AGENT SECURITE'
## Warning: Expecting logical in M2178 / R2178C13: got 'CAMEROUN'
## Warning: Expecting logical in M2179 / R2179C13: got 'CAMEROUN'
## Warning: Expecting logical in M2180 / R2180C13: got 'CAMEROUN'
## Warning: Expecting logical in M2181 / R2181C13: got 'CAMEROUN'
## Warning: Expecting logical in E2182 / R2182C5: got 'COMPTABLE'
## Warning: Expecting logical in M2182 / R2182C13: got 'CAMEROUN'
## Warning: Expecting logical in E2183 / R2183C5: got 'CHAUFFEUR DE LIGN'
## Warning: Expecting logical in M2183 / R2183C13: got 'CAMEROUN'
## Warning: Expecting logical in E2184 / R2184C5: got 'CHAUFFEUR DE VILL'
## Warning: Expecting logical in M2184 / R2184C13: got 'CAMEROUN'
## Warning: Expecting logical in E2185 / R2185C5: got 'SERVEUR'
## Warning: Expecting logical in M2185 / R2185C13: got 'CAMEROUN'
## Warning: Expecting logical in E2186 / R2186C5: got 'AGENT DE SECURITE'
## Warning: Expecting logical in M2186 / R2186C13: got 'CAMEROUN'
## Warning: Expecting logical in E2187 / R2187C5: got 'RESPONSABLE TECH'
## Warning: Expecting logical in M2187 / R2187C13: got 'CAMEROUN'
## Warning: Expecting logical in E2188 / R2188C5: got 'FOURNISSEUR'
## Warning: Expecting logical in M2188 / R2188C13: got 'CAMEROUN'
## Warning: Expecting logical in M2189 / R2189C13: got 'CAMEROUN'
## Warning: Expecting logical in E2190 / R2190C5: got 'CHAUFFEUR'
## Warning: Expecting logical in M2190 / R2190C13: got 'CAMEROUN'
## Warning: Expecting logical in E2191 / R2191C5: got 'DESTOCKAGE'
## Warning: Expecting logical in G2191 / R2191C7: got 'MARYAM'
## Warning: Expecting logical in M2191 / R2191C13: got 'CAMEROUN'
## Warning: Expecting logical in E2192 / R2192C5: got 'FOURNISSEUR'
## Warning: Expecting logical in G2192 / R2192C7: got 'PDG'
## Warning: Expecting logical in M2192 / R2192C13: got 'CAMEROUN'
## Warning: Expecting logical in J2193 / R2193C10: got 'B.P. 3509'
## Warning: Expecting logical in K2193 / R2193C11: got 'DOUALA'
## Warning: Expecting logical in L2193 / R2193C12: got 'LITTORAL'
## Warning: Expecting logical in M2193 / R2193C13: got 'CAMEROUN'
## Warning: Expecting logical in BJ2193 / R2193C62: got
## 'diectionsgmc@sgmc.somdiaa.com'
## Warning: Expecting logical in E2194 / R2194C5: got 'CLIENT'
## Warning: Expecting logical in K2194 / R2194C11: got 'YAOUNDE'
## Warning: Expecting logical in L2194 / R2194C12: got 'CENTRE'
## Warning: Expecting logical in M2194 / R2194C13: got 'CAMEROUN'
## Warning: Expecting logical in E2195 / R2195C5: got 'CLIENT'
## Warning: Expecting logical in K2195 / R2195C11: got 'YAOUNDE'
## Warning: Expecting logical in L2195 / R2195C12: got 'CENTRE'
## Warning: Expecting logical in M2195 / R2195C13: got 'CAMEROUN'
## Warning: Expecting logical in E2196 / R2196C5: got 'CLIENT'
## Warning: Expecting logical in K2196 / R2196C11: got 'YAOUNDE'
## Warning: Expecting logical in L2196 / R2196C12: got 'CENTRE'
## Warning: Expecting logical in M2196 / R2196C13: got 'CAMEROUN'
## Warning: Expecting logical in E2197 / R2197C5: got 'CLIENT'
## Warning: Expecting logical in K2197 / R2197C11: got 'YAOUNDE'
## Warning: Expecting logical in L2197 / R2197C12: got 'CENTRE'
## Warning: Expecting logical in M2197 / R2197C13: got 'CAMEROUN'
## Warning: Expecting logical in E2198 / R2198C5: got 'CLIENT'
## Warning: Expecting logical in G2198 / R2198C7: got 'MR. ANONG A'
## Warning: Expecting logical in K2198 / R2198C11: got 'YAOUNDE'
## Warning: Expecting logical in L2198 / R2198C12: got 'CENTRE'
## Warning: Expecting logical in M2198 / R2198C13: got 'CAMEROUN'
## Warning: Expecting logical in BJ2198 / R2198C62: got 'raye@yahoo.fr'
## Warning: Expecting logical in E2199 / R2199C5: got 'CLIENT'
## Warning: Expecting logical in G2199 / R2199C7: got 'A. ANONG'
## Warning: Expecting logical in K2199 / R2199C11: got 'YAOUNDE'
## Warning: Expecting logical in L2199 / R2199C12: got 'CENTRE'
## Warning: Expecting logical in M2199 / R2199C13: got 'CAMEROUN'
## Warning: Expecting logical in E2200 / R2200C5: got 'FOURNISSEUR'
## Warning: Expecting logical in J2200 / R2200C10: got 'BP 12296'
## Warning: Expecting logical in K2200 / R2200C11: got 'DOUALA'
## Warning: Expecting logical in L2200 / R2200C12: got 'LITTORAL'
## Warning: Expecting logical in M2200 / R2200C13: got 'CAMEROUN'
## Warning: Expecting logical in E2201 / R2201C5: got 'CLIENT'
## Warning: Expecting logical in G2201 / R2201C7: got 'PDG'
## Warning: Expecting logical in K2201 / R2201C11: got 'NGOUNDERE'
## Warning: Expecting logical in L2201 / R2201C12: got 'ADAMAOUA'
## Warning: Expecting logical in M2201 / R2201C13: got 'CAMEROUN'
## Warning: Expecting logical in E2202 / R2202C5: got 'CLIENT'
## Warning: Expecting logical in K2202 / R2202C11: got 'MAROUA'
## Warning: Expecting logical in L2202 / R2202C12: got 'EXTREME NORD'
## Warning: Expecting logical in M2202 / R2202C13: got 'CAMEROUN'
## Warning: Expecting logical in E2203 / R2203C5: got 'CLIENT'
## Warning: Expecting logical in K2203 / R2203C11: got 'YAOUNDE'
## Warning: Expecting logical in L2203 / R2203C12: got 'CENTRE'
## Warning: Expecting logical in M2203 / R2203C13: got 'CAMEROUN'
## Warning: Expecting logical in E2204 / R2204C5: got 'CLIENT'
## Warning: Expecting logical in K2204 / R2204C11: got 'YAOUNDE'
## Warning: Expecting logical in L2204 / R2204C12: got 'CENTRE'
## Warning: Expecting logical in M2204 / R2204C13: got 'CAMEROUN'
## Warning: Expecting logical in E2205 / R2205C5: got 'FOURNISSEUR'
## Warning: Expecting logical in J2205 / R2205C10: got 'BP 07815'
## Warning: Expecting logical in K2205 / R2205C11: got 'DOUALA'
## Warning: Expecting logical in L2205 / R2205C12: got 'LITORAL'
## Warning: Expecting logical in M2205 / R2205C13: got 'CAMEROUN'
## Warning: Expecting logical in E2206 / R2206C5: got 'CLIENT'
## Warning: Expecting logical in K2206 / R2206C11: got 'YAOUNDE'
## Warning: Expecting logical in L2206 / R2206C12: got 'CENTRE'
## Warning: Expecting logical in M2206 / R2206C13: got 'CAMEROUN'
## Warning: Expecting logical in E2207 / R2207C5: got 'CLIENT'
## Warning: Expecting logical in K2207 / R2207C11: got 'YAOUNDE'
## Warning: Expecting logical in L2207 / R2207C12: got 'CENTRE'
## Warning: Expecting logical in M2207 / R2207C13: got 'CAMEROUN'
## Warning: Expecting logical in E2208 / R2208C5: got 'CLIENT'
## Warning: Expecting logical in K2208 / R2208C11: got 'BAFOUSSAM'
## Warning: Expecting logical in L2208 / R2208C12: got 'OUEST'
## Warning: Expecting logical in M2208 / R2208C13: got 'CAMEROUN'
## Warning: Expecting logical in E2209 / R2209C5: got 'FOURNISSEUR'
## Warning: Expecting logical in K2209 / R2209C11: got 'DOUALA'
## Warning: Expecting logical in L2209 / R2209C12: got 'LITORAL'
## Warning: Expecting logical in M2209 / R2209C13: got 'CAMEROUN'
## Warning: Expecting logical in E2210 / R2210C5: got 'CLIENT'
## Warning: Expecting logical in K2210 / R2210C11: got 'YAOUNDE'
## Warning: Expecting logical in L2210 / R2210C12: got 'CENTRE'
## Warning: Expecting logical in M2210 / R2210C13: got 'CAMEROUN'
## Warning: Expecting logical in E2211 / R2211C5: got 'CLIENT'
## Warning: Expecting logical in K2211 / R2211C11: got 'YAOUNDE'
## Warning: Expecting logical in L2211 / R2211C12: got 'CENTRE'
## Warning: Expecting logical in M2211 / R2211C13: got 'CAMEROUN'
## Warning: Expecting logical in E2212 / R2212C5: got 'CLIENT'
## Warning: Expecting logical in K2212 / R2212C11: got 'BAFOUSSAM'
## Warning: Expecting logical in L2212 / R2212C12: got 'OUEST'
## Warning: Expecting logical in M2212 / R2212C13: got 'CAMEROUN'
## Warning: Expecting logical in E2213 / R2213C5: got 'CLIENT'
## Warning: Expecting logical in G2213 / R2213C7: got 'PDG'
## Warning: Expecting logical in K2213 / R2213C11: got 'GAROUA'
## Warning: Expecting logical in L2213 / R2213C12: got 'NORD'
## Warning: Expecting logical in M2213 / R2213C13: got 'CAMEROUN'
## Warning: Expecting logical in E2214 / R2214C5: got 'CLIENT'
## Warning: Expecting logical in K2214 / R2214C11: got 'GAROUA'
## Warning: Expecting logical in L2214 / R2214C12: got 'NORD'
## Warning: Expecting logical in M2214 / R2214C13: got 'CAMEROUN'
## Warning: Expecting logical in E2215 / R2215C5: got 'CLIENT'
## Warning: Expecting logical in K2215 / R2215C11: got 'YAOUNDE'
## Warning: Expecting logical in L2215 / R2215C12: got 'CENTRE'
## Warning: Expecting logical in M2215 / R2215C13: got 'CAMEROUN'
## Warning: Expecting logical in E2216 / R2216C5: got 'CLIENT'
## Warning: Expecting logical in K2216 / R2216C11: got 'YAOUNDE'
## Warning: Expecting logical in L2216 / R2216C12: got 'CENTRE'
## Warning: Expecting logical in M2216 / R2216C13: got 'CAMEROUN'
## Warning: Expecting logical in E2217 / R2217C5: got 'FOURNISSEUR'
## Warning: Expecting logical in K2217 / R2217C11: got 'DOUALA'
## Warning: Expecting logical in L2217 / R2217C12: got 'LITORAL'
## Warning: Expecting logical in M2217 / R2217C13: got 'CAMEROUN'
## Warning: Expecting logical in E2218 / R2218C5: got 'FOURNISSEUR'
## Warning: Expecting logical in J2218 / R2218C10: got 'B.P. 3509'
## Warning: Expecting logical in K2218 / R2218C11: got 'DOUALA'
## Warning: Expecting logical in L2218 / R2218C12: got 'LITTORAL'
## Warning: Expecting logical in M2218 / R2218C13: got 'CAMEROUN'
## Warning: Expecting logical in BJ2218 / R2218C62: got
## 'diectionsgmc@sgmc.somdiaa.com'
## Warning: Expecting logical in E2219 / R2219C5: got 'FOURNISSUER'
## Warning: Expecting logical in K2219 / R2219C11: got 'NGOUNDERE'
## Warning: Expecting logical in L2219 / R2219C12: got 'ADAMAOUA'
## Warning: Expecting logical in M2219 / R2219C13: got 'CAMEROUN'
## Warning: Expecting logical in AD2219 / R2219C30: got 'RC/NGA/2021/B/321'
## Warning: Expecting logical in E2220 / R2220C5: got 'CLIENT'
## Warning: Expecting logical in K2220 / R2220C11: got 'YAOUNDE'
## Warning: Expecting logical in L2220 / R2220C12: got 'CENTRE'
## Warning: Expecting logical in M2220 / R2220C13: got 'CAMEROUN'
## Warning: Expecting logical in E2221 / R2221C5: got 'CLIENT'
## Warning: Expecting logical in K2221 / R2221C11: got 'FOUMBAN'
## Warning: Expecting logical in L2221 / R2221C12: got 'OUEST'
## Warning: Expecting logical in M2221 / R2221C13: got 'CAMEROUN'
## Warning: Expecting logical in E2222 / R2222C5: got 'CLIENT'
## Warning: Expecting logical in K2222 / R2222C11: got 'YAOUNDE'
## Warning: Expecting logical in L2222 / R2222C12: got 'CENTRE'
## Warning: Expecting logical in M2222 / R2222C13: got 'CAMEROUN'
## Warning: Expecting logical in E2223 / R2223C5: got 'CLIENT'
## Warning: Expecting logical in K2223 / R2223C11: got 'NTUI'
## Warning: Expecting logical in L2223 / R2223C12: got 'CENTRE'
## Warning: Expecting logical in M2223 / R2223C13: got 'CAMEROUN'
## Warning: Expecting logical in E2224 / R2224C5: got 'DESTOCKEUR'
## Warning: Expecting logical in K2224 / R2224C11: got 'YAOUNDE'
## Warning: Expecting logical in L2224 / R2224C12: got 'CENTRE'
## Warning: Expecting logical in M2224 / R2224C13: got 'CAMEROUN'
## Warning: Expecting logical in E2225 / R2225C5: got 'CLIENT'
## Warning: Expecting logical in K2225 / R2225C11: got 'GAROUA'
## Warning: Expecting logical in L2225 / R2225C12: got 'NORD'
## Warning: Expecting logical in M2225 / R2225C13: got 'CAMEROUN'
## Warning: Expecting logical in E2226 / R2226C5: got 'CLIENT'
## Warning: Expecting logical in K2226 / R2226C11: got 'YAOUNDE'
## Warning: Expecting logical in L2226 / R2226C12: got 'CENTRE'
## Warning: Expecting logical in M2226 / R2226C13: got 'CAMEROUN'
## Warning: Expecting logical in E2227 / R2227C5: got 'CLIENT'
## Warning: Expecting logical in K2227 / R2227C11: got 'YAOUNDE'
## Warning: Expecting logical in L2227 / R2227C12: got 'CENTRE'
## Warning: Expecting logical in M2227 / R2227C13: got 'CAMEROUN'
## Warning: Expecting logical in E2228 / R2228C5: got 'FOURNISSEUR'
## Warning: Expecting logical in K2228 / R2228C11: got 'DOUALA'
## Warning: Expecting logical in L2228 / R2228C12: got 'LITORALE'
## Warning: Expecting logical in M2228 / R2228C13: got 'CAMEROUN'
## Warning: Expecting logical in E2229 / R2229C5: got 'CLIENT'
## Warning: Expecting logical in K2229 / R2229C11: got 'YAOUNDE'
## Warning: Expecting logical in L2229 / R2229C12: got 'CENTRE'
## Warning: Expecting logical in M2229 / R2229C13: got 'CAMEROUN'
## Warning: Expecting logical in E2230 / R2230C5: got 'CLIENT'
## Warning: Expecting logical in K2230 / R2230C11: got 'YAOUNDE'
## Warning: Expecting logical in L2230 / R2230C12: got 'CENTRE'
## Warning: Expecting logical in M2230 / R2230C13: got 'CAMEROUN'
## Warning: Expecting logical in E2231 / R2231C5: got 'CLIENT'
## Warning: Expecting logical in K2231 / R2231C11: got 'YAOUNDE'
## Warning: Expecting logical in L2231 / R2231C12: got 'CENTRE'
## Warning: Expecting logical in M2231 / R2231C13: got 'CAMEROUN'
## Warning: Expecting logical in E2232 / R2232C5: got 'CLIENT'
## Warning: Expecting logical in K2232 / R2232C11: got 'YAOUNDE'
## Warning: Expecting logical in L2232 / R2232C12: got 'CENTRE'
## Warning: Expecting logical in M2232 / R2232C13: got 'CAMEROUN'
## Warning: Expecting logical in E2233 / R2233C5: got 'CLIENT'
## Warning: Expecting logical in K2233 / R2233C11: got 'YAOUNDE'
## Warning: Expecting logical in L2233 / R2233C12: got 'CENTRE'
## Warning: Expecting logical in M2233 / R2233C13: got 'CAMEROUN'
## Warning: Expecting logical in E2234 / R2234C5: got 'FOURNISSEUR'
## Warning: Expecting logical in K2234 / R2234C11: got 'BAFOUSSAM'
## Warning: Expecting logical in L2234 / R2234C12: got 'OUEST'
## Warning: Expecting logical in M2234 / R2234C13: got 'CAMEROUN'
## Warning: Expecting logical in E2235 / R2235C5: got 'FOURNISSEUR'
## Warning: Expecting logical in K2235 / R2235C11: got 'DOUALA'
## Warning: Expecting logical in L2235 / R2235C12: got 'LITORALE'
## Warning: Expecting logical in M2235 / R2235C13: got 'CAMEROUN'
## Warning: Expecting logical in E2236 / R2236C5: got 'CLIENT'
## Warning: Expecting logical in K2236 / R2236C11: got 'NGOUNDERE'
## Warning: Expecting logical in L2236 / R2236C12: got 'ADAMAOUA'
## Warning: Expecting logical in M2236 / R2236C13: got 'CAMEROUN'
## Warning: Expecting logical in I2237 / R2237C9: got 'M HACHIOU'
## Warning: Expecting logical in I2238 / R2238C9: got 'CARREFOUR SANFRANCISCO
## (NKOLMBONG'
## Warning: Expecting logical in I2239 / R2239C9: got 'CARREFOUR SORCIER'
## Warning: Expecting logical in I2240 / R2240C9: got 'DISPENSAIRE'
## Warning: Expecting logical in I2241 / R2241C9: got 'HENRY NJEIH BOMA'
## Warning: Expecting logical in I2242 / R2242C9: got 'CNI 115754339'
## Warning: Expecting logical in I2243 / R2243C9: got 'MARCHE (LA LIGA)'
## Warning: Expecting logical in I2244 / R2244C9: got 'P108200496329P'
## Warning: Expecting logical in I2245 / R2245C9: got 'GRAND MARCHE'
## Warning: Expecting logical in I2246 / R2246C9: got 'LIVRAISON JUS CYPRINA
## NIXTE'
## Warning: Expecting logical in I2247 / R2247C9: got 'LIVRAISON ALLUMETTE'
## Warning: Expecting logical in I2248 / R2248C9: got 'ETS WILLIAM'
## Warning: Expecting logical in I2249 / R2249C9: got 'VENTE PROD8 ALIMENTAIRE'
## Warning: Expecting logical in I2250 / R2250C9: got 'P077400133046R'
## Warning: Expecting logical in I2251 / R2251C9: got 'CF M ZAKARIAO'
## Warning: Expecting logical in I2252 / R2252C9: got 'VIRGINIE'
## Warning: Expecting logical in I2253 / R2253C9: got 'COMPTANT'
## Warning: Expecting logical in I2254 / R2254C9: got 'FRERE CLT SARNOUBI'
## Warning: Expecting logical in I2255 / R2255C9: got 'VENTE DES MARCHANDISES'
## Warning: Expecting logical in I2256 / R2256C9: got 'CE70060I5J04ROPORX10'
## Warning: Expecting logical in I2257 / R2257C9: got 'COMMERCANT'
## Warning: Expecting logical in I2258 / R2258C9: got 'M020900026985M'
## Warning: Expecting logical in I2259 / R2259C9: got 'P026600010265N'
## Warning: Expecting logical in I2260 / R2260C9: got 'P127614410532H'
## Warning: Expecting logical in I2261 / R2261C9: got 'P038512615863R'
## Warning: Expecting logical in I2262 / R2262C9: got 'P088012333775M'
## Warning: Expecting logical in I2263 / R2263C9: got 'CNI 101906473'
## Warning: Expecting logical in I2264 / R2264C9: got 'CNI/101541145'
## Warning: Expecting logical in I2265 / R2265C9: got 'M. HACHIOU'
## Warning: Expecting logical in I2266 / R2266C9: got 'CAMP SONEL'
## Warning: Expecting logical in I2267 / R2267C9: got 'PROD'8 LIVRE; LA SARDINE ET
## AUTRE'
## Warning: Expecting logical in I2268 / R2268C9: got 'PROD'8 LIVRES; EMBALLAGE ET
## AUTRE'
## Warning: Expecting logical in I2269 / R2269C9: got 'PROD'8 LIVRES; RIZ.......'
## Warning: Expecting logical in I2270 / R2270C9: got 'PROD'8 LIVRES; MAYONNAISE,
## RIZ'
## Warning: Expecting logical in I2271 / R2271C9: got 'HACHIOU DAIROU'
## Warning: Expecting logical in I2272 / R2272C9: got '0'
## Warning: Expecting logical in I2273 / R2273C9: got 'M HACHIOU'
## Warning: Expecting logical in I2274 / R2274C9: got 'COMPTANT'
## Warning: Expecting logical in I2275 / R2275C9: got 'CE067352151ZYH770PMB2'
## Warning: Expecting logical in I2276 / R2276C9: got 'CNI°114765476'
## Warning: Expecting logical in I2277 / R2277C9: got 'CNI° 000330141'
## Warning: Expecting logical in I2278 / R2278C9: got 'PATES ALIMENTAIRES'
## Warning: Expecting logical in I2279 / R2279C9: got 'VENTE DE MARCHANDISE'
## Warning: Expecting logical in I2280 / R2280C9: got 'COMPTANT'
## Warning: Expecting logical in I2281 / R2281C9: got 'CLIENT COMPTANT'
## Warning: Expecting logical in I2282 / R2282C9: got 'CLIENT COMPTANT'
## Warning: Expecting logical in I2283 / R2283C9: got 'MANUENTIONNAIRE VOLEUR'
## Warning: Expecting logical in I2284 / R2284C9: got '10eme ARRET'
## Warning: Expecting logical in I2285 / R2285C9: got 'BARRIER'
## Warning: Expecting logical in I2286 / R2286C9: got 'PRODUIT LIVRES: LEVURE
## TEMPO'
## Warning: Expecting logical in I2287 / R2287C9: got 'Singapore 169208'
## Warning: Expecting logical in I2288 / R2288C9: got 'LIVRAISON AMELIORANT MIR
## PAIN'
## Warning: Expecting logical in I2289 / R2289C9: got '20170240557310334'
## Warning: Expecting logical in E2290 / R2290C5: got 'FOURNISSEUR'
## Warning: Expecting logical in G2290 / R2290C7: got 'M ABDOULAYE'
## Warning: Expecting logical in I2290 / R2290C9: got 'RC/DLA/2015/B/292'
## Warning: Expecting logical in K2290 / R2290C11: got 'DOUALA'
## Warning: Expecting logical in L2290 / R2290C12: got 'LITTORALE'
## Warning: Expecting logical in M2290 / R2290C13: got 'CAMEROUN'
## Warning: Expecting logical in BJ2290 / R2290C62: got 'info@transafrique.ae'
## Warning: Expecting logical in I2291 / R2291C9: got 'RC/YAE/2023/B/3183'
## Warning: Expecting logical in M2291 / R2291C13: got 'CAMEROUN'
## Warning: Expecting logical in AD2291 / R2291C30: got 'FABRICATION DES PALETTES
## EN BOIS'
## Warning: Expecting logical in I2292 / R2292C9: got 'Paficsarl@gmail.com'
## Warning: Expecting logical in S2292 / R2292C19: got 'MO513000488585'
## Warning: Expecting logical in I2293 / R2293C9: got 'LIVRAISON PALETTES'
## Warning: Expecting logical in S2293 / R2293C19: got 'PO98112244076Q'
## Warning: Expecting logical in S2294 / R2294C19: got '114748460'
## Warning: Expecting logical in S2295 / R2295C19: got '000774975'
## Warning: Expecting logical in S2296 / R2296C19: got 'RC/YAE/2022/11'
## Warning: Expecting logical in S2297 / R2297C19: got 'RC/M0E/2021/B/'
## Warning: Expecting logical in S2298 / R2298C19: got '697765160'
## Warning: Expecting logical in S2299 / R2299C19: got 'CE022045WHBXL3'
## Warning: Expecting logical in S2300 / R2300C19: got 'AE/2021/A/2335'
## Warning: Expecting logical in S2301 / R2301C19: got 'CNI °100468611'
## Warning: Expecting logical in S2302 / R2302C19: got '100724212'
## Warning: Expecting logical in S2303 / R2303C19: got '102117469'
## Warning: Expecting logical in S2304 / R2304C19: got '109628529'
## Warning: Expecting logical in S2305 / R2305C19: got '101556329'
## Warning: Expecting logical in S2306 / R2306C19: got '500018090'
## Warning: Expecting logical in S2307 / R2307C19: got '101136162'
## Warning: Expecting logical in S2308 / R2308C19: got '000268924'
## Warning: Expecting logical in S2309 / R2309C19: got '100798825'
## Warning: Expecting logical in S2310 / R2310C19: got '101974078'
## Warning: Expecting logical in S2311 / R2311C19: got 'M022317906466M'
## Warning: Expecting logical in S2312 / R2312C19: got 'MO10600019905X'
## Warning: Expecting logical in S2313 / R2313C19: got 'MO32118560975N'
## Warning: Expecting logical in S2314 / R2314C19: got 'M1214123542375'
## Warning: Expecting logical in S2315 / R2315C19: got 'KIT216'
## Warning: Expecting logical in S2316 / R2316C19: got 'CNI117018063'
## Warning: Expecting logical in S2317 / R2317C19: got 'KIT095 LT03'
## Warning: Expecting logical in E2318 / R2318C5: got 'CLIENT'
## Warning: Expecting logical in K2318 / R2318C11: got 'YAOUNDE'
## Warning: Expecting logical in L2318 / R2318C12: got 'CENTRE'
## Warning: Expecting logical in M2318 / R2318C13: got 'CAMEROUN'
## Warning: Expecting logical in S2318 / R2318C19: got '500064133'
## Warning: Expecting logical in E2319 / R2319C5: got 'CLIENT'
## Warning: Expecting logical in K2319 / R2319C11: got 'GAROUA'
## Warning: Expecting logical in L2319 / R2319C12: got 'NORD'
## Warning: Expecting logical in M2319 / R2319C13: got 'CAMEROUN'
## Warning: Expecting logical in S2319 / R2319C19: got '000208229'
## Warning: Expecting logical in S2320 / R2320C19: got '000-0789833-1'
## Warning: Expecting logical in S2321 / R2321C19: got '310-1013971-5'
## Warning: Expecting logical in S2322 / R2322C19: got '321-0121308-0'
## Warning: Expecting logical in S2323 / R2323C19: got '321-1015935-8'
## Warning: Expecting logical in S2324 / R2324C19: got '321-1028712-6'
## Warning: Expecting logical in S2325 / R2325C19: got '321-1090132-0'
## Warning: Expecting logical in S2326 / R2326C19: got '321-1104281-7'
## Warning: Expecting logical in S2327 / R2327C19: got '321-1105467-3'
## Warning: Expecting logical in S2328 / R2328C19: got '324-1035970-1'
## Warning: Expecting logical in S2329 / R2329C19: got '325-0120848-7'
## Warning: Expecting logical in S2330 / R2330C19: got '326-1007495-3'
## Warning: Expecting logical in S2331 / R2331C19: got '326-1018365-5'
## Warning: Expecting logical in S2332 / R2332C19: got '326-1035081-7'
## Warning: Expecting logical in S2333 / R2333C19: got '327-1011628-3'
## Warning: Expecting logical in S2334 / R2334C19: got '327-1014335-2'
## Warning: Expecting logical in S2335 / R2335C19: got '327-1016414-3'
## Warning: Expecting logical in S2336 / R2336C19: got '327-1019172-4'
## Warning: Expecting logical in S2337 / R2337C19: got '327-1020561-5'
## Warning: Expecting logical in S2338 / R2338C19: got '327-1037782-8'
## Warning: Expecting logical in S2339 / R2339C19: got '327-1038229-9'
## Warning: Expecting logical in S2340 / R2340C19: got '327-1041571-9'
## Warning: Expecting logical in S2341 / R2341C19: got '327-1050020-5'
## Warning: Expecting logical in S2342 / R2342C19: got '327-1053021-0'
## Warning: Expecting logical in S2343 / R2343C19: got '327-1053022-8'
## Warning: Expecting logical in S2344 / R2344C19: got '327-1053208-3'
## Warning: Expecting logical in S2345 / R2345C19: got '327-1053227-3'
## Warning: Expecting logical in S2346 / R2346C19: got '327-1053228-1'
## Warning: Expecting logical in S2347 / R2347C19: got '327-1054160-5'
## Warning: Expecting logical in S2348 / R2348C19: got '327-1058771-5'
## Warning: Expecting logical in S2349 / R2349C19: got '327-1058772-3'
## Warning: Expecting logical in S2350 / R2350C19: got '327-1058773-1'
## Warning: Expecting logical in S2351 / R2351C19: got '327-1058774-9'
## Warning: Expecting logical in S2352 / R2352C19: got '327-1058775-6'
## Warning: Expecting logical in S2353 / R2353C19: got '327-1058778-0'
## Warning: Expecting logical in S2354 / R2354C19: got '327-1058779-8'
## Warning: Expecting logical in S2355 / R2355C19: got '327-1058780-6'
## Warning: Expecting logical in S2356 / R2356C19: got '327-1058781-4'
## Warning: Expecting logical in S2357 / R2357C19: got '327-1058782-2'
## Warning: Expecting logical in S2358 / R2358C19: got '327-1058827-5'
## Warning: Expecting logical in S2359 / R2359C19: got '327-1058840-8'
## Warning: Expecting logical in S2360 / R2360C19: got '327-1058841-6'
## Warning: Expecting logical in S2361 / R2361C19: got '327-1058846-5'
## Warning: Expecting logical in S2362 / R2362C19: got '327-1058848-1'
## Warning: Expecting logical in S2363 / R2363C19: got '327-1058911-7'
## Warning: Expecting logical in S2364 / R2364C19: got '327-1058912-5'
## Warning: Expecting logical in S2365 / R2365C19: got '327-1058913-3'
## Warning: Expecting logical in S2366 / R2366C19: got '327-1058914-1'
## Warning: Expecting logical in S2367 / R2367C19: got '327-1058915-8'
## Warning: Expecting logical in S2368 / R2368C19: got '327-1058916-6'
## Warning: Expecting logical in S2369 / R2369C19: got '327-1058923-2'
## Warning: Expecting logical in S2370 / R2370C19: got '327-1058926-5'
## Warning: Expecting logical in S2371 / R2371C19: got '327-1058928-1'
## Warning: Expecting logical in S2372 / R2372C19: got '327-1058930-7'
## Warning: Expecting logical in S2373 / R2373C19: got '327-1058932-3'
## Warning: Expecting logical in S2374 / R2374C19: got '327-1058934-9'
## Warning: Expecting logical in S2375 / R2375C19: got '327-1058937-2'
## Warning: Expecting logical in S2376 / R2376C19: got '327-1058941-4'
## Warning: Expecting logical in S2377 / R2377C19: got '327-1058942-2'
## Warning: Expecting logical in S2378 / R2378C19: got '327-1058943-0'
## Warning: Expecting logical in S2379 / R2379C19: got '327-1058944-8'
## Warning: Expecting logical in S2380 / R2380C19: got '327-1058945-5'
## Warning: Expecting logical in S2381 / R2381C19: got '327-1058947-1'
## Warning: Expecting logical in S2382 / R2382C19: got '327-1058948-9'
## Warning: Expecting logical in S2383 / R2383C19: got '327-1058951-3'
## Warning: Expecting logical in S2384 / R2384C19: got '327-1058953-9'
## Warning: Expecting logical in S2385 / R2385C19: got '327-1058958-8'
## Warning: Expecting logical in S2386 / R2386C19: got '327-1058962-0'
## Warning: Expecting logical in S2387 / R2387C19: got '327-1058963-8'
## Warning: Expecting logical in S2388 / R2388C19: got '327-1058964-6'
## Warning: Expecting logical in S2389 / R2389C19: got '327-1058965-3'
## Warning: Expecting logical in S2390 / R2390C19: got '327-1058966-1'
## Warning: Expecting logical in S2391 / R2391C19: got '327-1058967-9'
## Warning: Expecting logical in S2392 / R2392C19: got '327-1058968-7'
## Warning: Expecting logical in S2393 / R2393C19: got '327-1058970-3'
## Warning: Expecting logical in S2394 / R2394C19: got '327-1058971-1'
## Warning: Expecting logical in S2395 / R2395C19: got '327-1058972-9'
## Warning: Expecting logical in S2396 / R2396C19: got '327-1058974-5'
## Warning: Expecting logical in S2397 / R2397C19: got '327-1058975-2'
## Warning: Expecting logical in S2398 / R2398C19: got '327-1058976-0'
## Warning: Expecting logical in S2399 / R2399C19: got '327-1058977-8'
## Warning: Expecting logical in S2400 / R2400C19: got '327-1058978-6'
## Warning: Expecting logical in S2401 / R2401C19: got '327-1058979-4'
## Warning: Expecting logical in S2402 / R2402C19: got '327-1058981-0'
## Warning: Expecting logical in S2403 / R2403C19: got '327-1058982-8'
## Warning: Expecting logical in S2404 / R2404C19: got '327-1058983-6'
## Warning: Expecting logical in S2405 / R2405C19: got '327-1058984-4'
## Warning: Expecting logical in S2406 / R2406C19: got '327-1058985-1'
## Warning: Expecting logical in S2407 / R2407C19: got '327-1058986-9'
## Warning: Expecting logical in S2408 / R2408C19: got '327-1059031-3'
## Warning: Expecting logical in S2409 / R2409C19: got '327-1059032-1'
## Warning: Expecting logical in S2410 / R2410C19: got '327-1059033-9'
## Warning: Expecting logical in S2411 / R2411C19: got '327-1059034-7'
## Warning: Expecting logical in S2412 / R2412C19: got '327-1059880-3'
## Warning: Expecting logical in S2413 / R2413C19: got '327-1060006-2'
## Warning: Expecting logical in S2414 / R2414C19: got '327-1060007-0'
## Warning: Expecting logical in S2415 / R2415C19: got '327-1060010-4'
## Warning: Expecting logical in S2416 / R2416C19: got '329-0013424-7'
## Warning: Expecting logical in S2417 / R2417C19: got '329-0016217-2'
## Warning: Expecting logical in S2418 / R2418C19: got '351-1127663-1'
## Warning: Expecting logical in S2419 / R2419C19: got '354-1005515-0'
## Warning: Expecting logical in S2420 / R2420C19: got '356-1059517-1'
## Warning: Expecting logical in S2421 / R2421C19: got '357-1010926-2'
## Warning: Expecting logical in S2422 / R2422C19: got '357-1012805-6'
## Warning: Expecting logical in S2423 / R2423C19: got '357-1027962-8'
## Warning: Expecting logical in S2424 / R2424C19: got '390-1015961-4'
## Warning: Expecting logical in S2425 / R2425C19: got '327-1058961-2'
## Warning: Expecting logical in S2426 / R2426C19: got '694074958'
## Warning: Expecting logical in S2427 / R2427C19: got 'RC/DLA/1981/B'
## Warning: Expecting logical in S2428 / R2428C19: got 'P097300537725Q'
## Warning: Expecting logical in S2429 / R2429C19: got 'P029212629622M'
## Warning: Expecting logical in S2430 / R2430C19: got 'M122217786007N'

mise en forme et enrichissement de la table vente

head(ventes)
## # A tibble: 6 × 15
##   `code tiers`  `type fact`  `n° doucment` `abr document` `type document` 
##   <chr>         <chr>        <chr>         <chr>          <chr>           
## 1 CCE08MA1KAJO1 Facture cpta FV000006      FV0            Facture de vente
## 2 CCE08MA1KAJO1 Facture cpta FV000006      FV0            Facture de vente
## 3 CCE08MA1KAJO1 Facture cpta FV000006      FV0            Facture de vente
## 4 CCE08MA1STEP1 Facture cpta FV000010      FV0            Facture de vente
## 5 CCE08MA1STEP1 Facture cpta FV000010      FV0            Facture de vente
## 6 CCE08MA1DJSY1 Facture cpta FV000007      FV0            Facture de vente
## # ℹ 10 more variables: date <dttm>, `reference articles` <chr>,
## #   désignations <chr>, qtés <dbl>, `prix unitaire` <dbl>,
## #   `montant total` <dbl>, clients <chr>, commercial <chr>,
## #   `montant remise` <dbl>, `% remise` <dbl>
ventes1 <- merge(ventes, article, by.x = "reference articles", by.y = "ar_ref")
View(ventes1)
ventes2 <- ventes1 %>%
  mutate(
    cout_achat_attendu = qtés * ar_prixach,
    chiffre_affaires_attendu = qtés * ar_prixven,
    chiffre_affaires_net = `montant total` - `montant remise`,
    marge = chiffre_affaires_net - cout_achat_attendu,
    marge_attendue = chiffre_affaires_attendu - cout_achat_attendu
  )
View(ventes2)
ventes_marges <- ventes2
head(ventes_marges)
##   reference articles    code tiers    type fact n° doucment abr document
## 1             ALLA01 CCE08MA1CTCO1 Facture cpta    FRV00348          FRV
## 2             ALLA01 CCE07MA1MOKO2 Facture cpta    FV008029          FV0
## 3             ALLA01 CLT08MA1CODO1 Facture cpta    FV022212          FV0
## 4             ALLA01 CCE08MA1VEPR1 Facture cpta    FV008297          FV0
## 5             ALLA01 CCE08MA1NOEL1 Facture cpta    FV008781          FV0
## 6             ALLA01 CCE08MA1CAMI1 Facture cpta    FRV01215          FRV
##              type document       date          désignations qtés prix unitaire
## 1 Facture de retour client 2021-09-03 ALLUMETTE APPLE 12*12 2.00          1700
## 2         Facture de vente 2021-12-30 ALLUMETTE APPLE 12*12 2.00            10
## 3         Facture de vente 2022-12-13 ALLUMETTE APPLE 12*12 3.00         20500
## 4         Facture de vente 2021-12-22 ALLUMETTE APPLE 12*12 1.00         20500
## 5         Facture de vente 2022-01-14 ALLUMETTE APPLE 12*12 0.41         22200
## 6 Facture de retour client 2021-12-22 ALLUMETTE APPLE 12*12 1.00         20500
##   montant total                  clients                commercial
## 1          3400          CLIENT COMPTANT          CLIENTS SPECIAUX
## 2            20                 MOKOLO 2          CLIENTS MOKOLO 2
## 3         61500          COMMANDO DOUALA          CLIENTS LITTORAL
## 4         20500         FOIRE NKONDENGUI CLIENTS MOHAMADOU DAHIROU
## 5          9102 NOEL POUR TOUS BOULEVARD CLIENTS MOHAMADOU DAHIROU
## 6         20500          CARAVANE MINCOM CLIENTS MOHAMADOU DAHIROU
##   montant remise % remise             ar_design fa_codefamille ar_substitut
## 1              0        0 ALLUMETTE APPLE 12*12            BAZ           NA
## 2              0        0 ALLUMETTE APPLE 12*12            BAZ           NA
## 3              0        0 ALLUMETTE APPLE 12*12            BAZ           NA
## 4              0        0 ALLUMETTE APPLE 12*12            BAZ           NA
## 5              0        0 ALLUMETTE APPLE 12*12            BAZ           NA
## 6              0        0 ALLUMETTE APPLE 12*12            BAZ           NA
##   ar_raccourci ar_garantie ar_unitepoids ar_poidsnet ar_poidsbrut ar_uniteven
## 1           NA           0             2         144           11           1
## 2           NA           0             2         144           11           1
## 3           NA           0             2         144           11           1
## 4           NA           0             2         144           11           1
## 5           NA           0             2         144           11           1
## 6           NA           0             2         144           11           1
##   ar_prixach ar_coef ar_prixven ar_prixttc ar_gamme1 ar_gamme2 ar_suivistock
## 1      19000       0      20500          0         0         0             2
## 2      19000       0      20500          0         0         0             2
## 3      19000       0      20500          0         0         0             2
## 4      19000       0      20500          0         0         0             2
## 5      19000       0      20500          0         0         0             2
## 6      19000       0      20500          0         0         0             2
##   ar_nomencl ar_stat01 ar_stat02 ar_stat03 ar_stat04 ar_stat05 ar_escompte
## 1          0        NA        NA        NA        NA        NA           0
## 2          0        NA        NA        NA        NA        NA           0
## 3          0        NA        NA        NA        NA        NA           0
## 4          0        NA        NA        NA        NA        NA           0
## 5          0        NA        NA        NA        NA        NA           0
## 6          0        NA        NA        NA        NA        NA           0
##   ar_delai ar_horsstat ar_vtedebit ar_notimp ar_sommeil ar_langue1 ar_langue2
## 1        0           0           0         0          0         NA         NA
## 2        0           0           0         0          0         NA         NA
## 3        0           0           0         0          0         NA         NA
## 4        0           0           0         0          0         NA         NA
## 5        0           0           0         0          0         NA         NA
## 6        0           0           0         0          0         NA         NA
##   ar_edicode ar_codebarre ar_codefiscal ar_pays ar_frais01fr_denomination
## 1         NA           NA            NA      NA          Coût de stockage
## 2         NA           NA            NA      NA          Coût de stockage
## 3         NA           NA            NA      NA          Coût de stockage
## 4         NA           NA            NA      NA          Coût de stockage
## 5         NA           NA            NA      NA          Coût de stockage
## 6         NA           NA            NA      NA          Coût de stockage
##   ar_frais01fr_rem01rem_valeur ar_frais01fr_rem01rem_type
## 1                            0                          0
## 2                            0                          0
## 3                            0                          0
## 4                            0                          0
## 5                            0                          0
## 6                            0                          0
##   ar_frais01fr_rem02rem_valeur ar_frais01fr_rem02rem_type
## 1                            0                          0
## 2                            0                          0
## 3                            0                          0
## 4                            0                          0
## 5                            0                          0
## 6                            0                          0
##   ar_frais01fr_rem03rem_valeur ar_frais01fr_rem03rem_type
## 1                            0                          0
## 2                            0                          0
## 3                            0                          0
## 4                            0                          0
## 5                            0                          0
## 6                            0                          0
##   ar_frais02fr_denomination ar_frais02fr_rem01rem_valeur
## 1         Coût de transport                            0
## 2         Coût de transport                            0
## 3         Coût de transport                            0
## 4         Coût de transport                            0
## 5         Coût de transport                            0
## 6         Coût de transport                            0
##   ar_frais02fr_rem01rem_type ar_frais02fr_rem02rem_valeur
## 1                          0                            0
## 2                          0                            0
## 3                          0                            0
## 4                          0                            0
## 5                          0                            0
## 6                          0                            0
##   ar_frais02fr_rem02rem_type ar_frais02fr_rem03rem_valeur
## 1                          0                            0
## 2                          0                            0
## 3                          0                            0
## 4                          0                            0
## 5                          0                            0
## 6                          0                            0
##   ar_frais02fr_rem03rem_type ar_frais03fr_denomination
## 1                          0               Coût annexe
## 2                          0               Coût annexe
## 3                          0               Coût annexe
## 4                          0               Coût annexe
## 5                          0               Coût annexe
## 6                          0               Coût annexe
##   ar_frais03fr_rem01rem_valeur ar_frais03fr_rem01rem_type
## 1                            0                          0
## 2                            0                          0
## 3                            0                          0
## 4                            0                          0
## 5                            0                          0
## 6                            0                          0
##   ar_frais03fr_rem02rem_valeur ar_frais03fr_rem02rem_type
## 1                            0                          0
## 2                            0                          0
## 3                            0                          0
## 4                            0                          0
## 5                            0                          0
## 6                            0                          0
##   ar_frais03fr_rem03rem_valeur ar_frais03fr_rem03rem_type ar_condition ar_punet
## 1                            0                          0            0        0
## 2                            0                          0            0        0
## 3                            0                          0            0        0
## 4                            0                          0            0        0
## 5                            0                          0            0        0
## 6                            0                          0            0        0
##   ar_contremarque ar_factpoids ar_factforfait ar_saisievar ar_transfere
## 1               0            0              0            0            0
## 2               0            0              0            0            0
## 3               0            0              0            0            0
## 4               0            0              0            0            0
## 5               0            0              0            0            0
## 6               0            0              0            0            0
##   ar_publie ar_datemodif ar_photo ar_prixachnouv ar_coefnouv ar_prixvennouv
## 1         0        45587       NA              0           0              0
## 2         0        45587       NA              0           0              0
## 3         0        45587       NA              0           0              0
## 4         0        45587       NA              0           0              0
## 5         0        45587       NA              0           0              0
## 6         0        45587       NA              0           0              0
##   ar_dateapplication ar_coutstd ar_qtecomp ar_qteoperatoire co_no cbco_no
## 1        1/1/53 0:00          0          1                1     0      NA
## 2        1/1/53 0:00          0          1                1     0      NA
## 3        1/1/53 0:00          0          1                1     0      NA
## 4        1/1/53 0:00          0          1                1     0      NA
## 5        1/1/53 0:00          0          1                1     0      NA
## 6        1/1/53 0:00          0          1                1     0      NA
##   ar_prevision cl_no1 cbcl_no1 cl_no2 cbcl_no2 cl_no3 cbcl_no3 cl_no4 cbcl_no4
## 1            0      0       NA      0       NA      0       NA      0       NA
## 2            0      0       NA      0       NA      0       NA      0       NA
## 3            0      0       NA      0       NA      0       NA      0       NA
## 4            0      0       NA      0       NA      0       NA      0       NA
## 5            0      0       NA      0       NA      0       NA      0       NA
## 6            0      0       NA      0       NA      0       NA      0       NA
##   ar_type rp_codedefaut ar_nature ar_delaifabrication ar_nbcolis
## 1       0            NA         0                   0          0
## 2       0            NA         0                   0          0
## 3       0            NA         0                   0          0
## 4       0            NA         0                   0          0
## 5       0            NA         0                   0          0
## 6       0            NA         0                   0          0
##   ar_delaiperemption ar_delaisecurite ar_fictif ar_soustraitance
## 1                  0                0         0                0
## 2                  0                0         0                0
## 3                  0                0         0                0
## 4                  0                0         0                0
## 5                  0                0         0                0
## 6                  0                0         0                0
##   ar_typelancement ar_cycle ar_criticite ar_interdirecommande ar_exclure cbprot
## 1                0        0            0                    0          0      0
## 2                0        0            0                    0          0      0
## 3                0        0            0                    0          0      0
## 4                0        0            0                    0          0      0
## 5                0        0            0                    0          0      0
## 6                0        0            0                    0          0      0
##   cbmarq cbcreateur cbmodification cbreplication cbflag cbcreation
## 1      1       COLU       45587.39             0      0   45408.42
## 2      1       COLU       45587.39             0      0   45408.42
## 3      1       COLU       45587.39             0      0   45408.42
## 4      1       COLU       45587.39             0      0   45408.42
## 5      1       COLU       45587.39             0      0   45408.42
## 6      1       COLU       45587.39             0      0   45408.42
##                         cbcreationuser cout_achat_attendu
## 1 F8E289D9-F45C-400A-AF90-F128F327FECC              38000
## 2 F8E289D9-F45C-400A-AF90-F128F327FECC              38000
## 3 F8E289D9-F45C-400A-AF90-F128F327FECC              57000
## 4 F8E289D9-F45C-400A-AF90-F128F327FECC              19000
## 5 F8E289D9-F45C-400A-AF90-F128F327FECC               7790
## 6 F8E289D9-F45C-400A-AF90-F128F327FECC              19000
##   chiffre_affaires_attendu chiffre_affaires_net  marge marge_attendue
## 1                    41000                 3400 -34600           3000
## 2                    41000                   20 -37980           3000
## 3                    61500                61500   4500           4500
## 4                    20500                20500   1500           1500
## 5                     8405                 9102   1312            615
## 6                    20500                20500   1500           1500
View(ventes_marges)
ventes_marges1 <- ventes_marges[, -30:-119]
View(ventes_marges1)
ventes_marges2 <- ventes_marges1[, -28:-30]
View(ventes_marges2)
ventes_marge3 <- ventes_marges2[, -18:-23]
View(ventes_marge3)
ventes_marge4 <- ventes_marge3[, -20]
View(ventes_marge4)
ventes_marge5 <- ventes_marge4[, -16]
View(ventes_marge5)

mise en forme et enrichissement de la table achat

View(achats)
achats1 <- merge(achats, article, by.x = "reference articles", by.y = "ar_ref" )
head(achats1)
##   reference articles code tiers    type fact n° doucment abr document
## 1             ALLC05    F02FSP1 Facture cpta    FA011260          FA0
## 2             ALLC05    F02FSP1 Facture cpta    FA011452          FA0
## 3             ALLC05    F02FSP1 Facture cpta    FA011010          FA0
## 4             ALLE01    F02FSP1 Facture cpta    FA012302          FA0
## 5             ALLE01    F0GEEX1 Facture cpta    FA005462          FA0
## 6             ALLE01    F0GEEX1 Facture cpta    FA002074          FA0
##     type document       date                  désignations qtés prix unitaire
## 1 Facture d'achat 2024-05-21 ALLUMETTE CHEF PARISIEN 12*12    1      22500.00
## 2 Facture d'achat 2024-05-29 ALLUMETTE CHEF PARISIEN 12*12    1      22500.00
## 3 Facture d'achat 2024-05-08 ALLUMETTE CHEF PARISIEN 12*12    1      22500.00
## 4 Facture d'achat 2024-08-20          ALLUMETTE EPIQ 12*12    2      22000.00
## 5 Facture d'achat 2022-09-21          ALLUMETTE EPIQ 12*12 1600      24200.00
## 6 Facture d'achat 2022-01-20          ALLUMETTE EPIQ 12*12 1587      21303.45
##   montant total % remise montant remise montant net
## 1         22500     <NA>              0       22500
## 2         22500     <NA>              0       22500
## 3         22500     <NA>              0       22500
## 4         44000     <NA>              0       44000
## 5      38720000     <NA>              0    38720000
## 6      33808575     <NA>              0    33808575
##                       ar_design fa_codefamille ar_substitut ar_raccourci
## 1 ALLUMETTE CHEF PARISIEN 12*12            BAZ           NA           NA
## 2 ALLUMETTE CHEF PARISIEN 12*12            BAZ           NA           NA
## 3 ALLUMETTE CHEF PARISIEN 12*12            BAZ           NA           NA
## 4          ALLUMETTE EPIQ 12*12            BAZ           NA           NA
## 5          ALLUMETTE EPIQ 12*12            BAZ           NA           NA
## 6          ALLUMETTE EPIQ 12*12            BAZ           NA           NA
##   ar_garantie ar_unitepoids ar_poidsnet ar_poidsbrut ar_uniteven ar_prixach
## 1           0             2         144      10.9872           4      22500
## 2           0             2         144      10.9872           4      22500
## 3           0             2         144      10.9872           4      22500
## 4           0             2         144      11.0000           1      21303
## 5           0             2         144      11.0000           1      21303
## 6           0             2         144      11.0000           1      21303
##   ar_coef ar_prixven ar_prixttc ar_gamme1 ar_gamme2 ar_suivistock ar_nomencl
## 1       0      22700          0         0         0             2          0
## 2       0      22700          0         0         0             2          0
## 3       0      22700          0         0         0             2          0
## 4       0      22800          0         0         0             2          0
## 5       0      22800          0         0         0             2          0
## 6       0      22800          0         0         0             2          0
##   ar_stat01 ar_stat02 ar_stat03 ar_stat04 ar_stat05 ar_escompte ar_delai
## 1        NA        NA        NA        NA        NA           0        0
## 2        NA        NA        NA        NA        NA           0        0
## 3        NA        NA        NA        NA        NA           0        0
## 4        NA        NA        NA        NA        NA           0        0
## 5        NA        NA        NA        NA        NA           0        0
## 6        NA        NA        NA        NA        NA           0        0
##   ar_horsstat ar_vtedebit ar_notimp ar_sommeil ar_langue1 ar_langue2 ar_edicode
## 1           0           0         0          0         NA         NA         NA
## 2           0           0         0          0         NA         NA         NA
## 3           0           0         0          0         NA         NA         NA
## 4           0           0         0          0         NA         NA         NA
## 5           0           0         0          0         NA         NA         NA
## 6           0           0         0          0         NA         NA         NA
##   ar_codebarre ar_codefiscal ar_pays ar_frais01fr_denomination
## 1           NA            NA      NA          Coût de stockage
## 2           NA            NA      NA          Coût de stockage
## 3           NA            NA      NA          Coût de stockage
## 4           NA            NA      NA          Coût de stockage
## 5           NA            NA      NA          Coût de stockage
## 6           NA            NA      NA          Coût de stockage
##   ar_frais01fr_rem01rem_valeur ar_frais01fr_rem01rem_type
## 1                            0                          0
## 2                            0                          0
## 3                            0                          0
## 4                            0                          0
## 5                            0                          0
## 6                            0                          0
##   ar_frais01fr_rem02rem_valeur ar_frais01fr_rem02rem_type
## 1                            0                          0
## 2                            0                          0
## 3                            0                          0
## 4                            0                          0
## 5                            0                          0
## 6                            0                          0
##   ar_frais01fr_rem03rem_valeur ar_frais01fr_rem03rem_type
## 1                            0                          0
## 2                            0                          0
## 3                            0                          0
## 4                            0                          0
## 5                            0                          0
## 6                            0                          0
##   ar_frais02fr_denomination ar_frais02fr_rem01rem_valeur
## 1         Coût de transport                            0
## 2         Coût de transport                            0
## 3         Coût de transport                            0
## 4         Coût de transport                            0
## 5         Coût de transport                            0
## 6         Coût de transport                            0
##   ar_frais02fr_rem01rem_type ar_frais02fr_rem02rem_valeur
## 1                          0                            0
## 2                          0                            0
## 3                          0                            0
## 4                          0                            0
## 5                          0                            0
## 6                          0                            0
##   ar_frais02fr_rem02rem_type ar_frais02fr_rem03rem_valeur
## 1                          0                            0
## 2                          0                            0
## 3                          0                            0
## 4                          0                            0
## 5                          0                            0
## 6                          0                            0
##   ar_frais02fr_rem03rem_type ar_frais03fr_denomination
## 1                          0               Coût annexe
## 2                          0               Coût annexe
## 3                          0               Coût annexe
## 4                          0               Coût annexe
## 5                          0               Coût annexe
## 6                          0               Coût annexe
##   ar_frais03fr_rem01rem_valeur ar_frais03fr_rem01rem_type
## 1                            0                          0
## 2                            0                          0
## 3                            0                          0
## 4                            0                          0
## 5                            0                          0
## 6                            0                          0
##   ar_frais03fr_rem02rem_valeur ar_frais03fr_rem02rem_type
## 1                            0                          0
## 2                            0                          0
## 3                            0                          0
## 4                            0                          0
## 5                            0                          0
## 6                            0                          0
##   ar_frais03fr_rem03rem_valeur ar_frais03fr_rem03rem_type ar_condition ar_punet
## 1                            0                          0            0    22500
## 2                            0                          0            0    22500
## 3                            0                          0            0    22500
## 4                            0                          0            0    22000
## 5                            0                          0            0    22000
## 6                            0                          0            0    22000
##   ar_contremarque ar_factpoids ar_factforfait ar_saisievar ar_transfere
## 1               0            0              0            0            0
## 2               0            0              0            0            0
## 3               0            0              0            0            0
## 4               0            0              0            0            0
## 5               0            0              0            0            0
## 6               0            0              0            0            0
##   ar_publie ar_datemodif ar_photo ar_prixachnouv ar_coefnouv ar_prixvennouv
## 1         0        45441       NA              0           0              0
## 2         0        45441       NA              0           0              0
## 3         0        45441       NA              0           0              0
## 4         0        45512       NA              0           0              0
## 5         0        45512       NA              0           0              0
## 6         0        45512       NA              0           0              0
##   ar_dateapplication ar_coutstd ar_qtecomp ar_qteoperatoire co_no cbco_no
## 1        1/1/53 0:00          0          1                1     0      NA
## 2        1/1/53 0:00          0          1                1     0      NA
## 3        1/1/53 0:00          0          1                1     0      NA
## 4        1/1/53 0:00          0          1                1     0      NA
## 5        1/1/53 0:00          0          1                1     0      NA
## 6        1/1/53 0:00          0          1                1     0      NA
##   ar_prevision cl_no1 cbcl_no1 cl_no2 cbcl_no2 cl_no3 cbcl_no3 cl_no4 cbcl_no4
## 1            0      0       NA      0       NA      0       NA      0       NA
## 2            0      0       NA      0       NA      0       NA      0       NA
## 3            0      0       NA      0       NA      0       NA      0       NA
## 4            0      0       NA      0       NA      0       NA      0       NA
## 5            0      0       NA      0       NA      0       NA      0       NA
## 6            0      0       NA      0       NA      0       NA      0       NA
##   ar_type rp_codedefaut ar_nature ar_delaifabrication ar_nbcolis
## 1       0            NA         0                   0          0
## 2       0            NA         0                   0          0
## 3       0            NA         0                   0          0
## 4       0            NA         0                   0          0
## 5       0            NA         0                   0          0
## 6       0            NA         0                   0          0
##   ar_delaiperemption ar_delaisecurite ar_fictif ar_soustraitance
## 1                  0                0         0                0
## 2                  0                0         0                0
## 3                  0                0         0                0
## 4                  0                0         0                0
## 5                  0                0         0                0
## 6                  0                0         0                0
##   ar_typelancement ar_cycle ar_criticite ar_interdirecommande ar_exclure cbprot
## 1                0        0            0                    0          0      0
## 2                0        0            0                    0          0      0
## 3                0        0            0                    0          0      0
## 4                0        0            0                    0          0      0
## 5                0        0            0                    0          0      0
## 6                0        0            0                    0          0      0
##   cbmarq cbcreateur cbmodification cbreplication cbflag cbcreation
## 1      2       COLU       45441.49             0      0   45408.42
## 2      2       COLU       45441.49             0      0   45408.42
## 3      2       COLU       45441.49             0      0   45408.42
## 4      3       COLU       45517.51             0      0   45408.42
## 5      3       COLU       45517.51             0      0   45408.42
## 6      3       COLU       45517.51             0      0   45408.42
##                         cbcreationuser
## 1 F8E289D9-F45C-400A-AF90-F128F327FECC
## 2 F8E289D9-F45C-400A-AF90-F128F327FECC
## 3 F8E289D9-F45C-400A-AF90-F128F327FECC
## 4 F8E289D9-F45C-400A-AF90-F128F327FECC
## 5 F8E289D9-F45C-400A-AF90-F128F327FECC
## 6 F8E289D9-F45C-400A-AF90-F128F327FECC
View(achats1)
achats2 <- achats1[,-70:-119]
View(achats2)  
achats3 <- achats2[,-50:-69]
View(achats3)
achats4 <- achats3[,-30:-49]
View(achats4)
achats5 <- achats4[,-27:-29]
View(achats5)
achat6 <- achats5[,-25]
View(achat6)
achats7 <- achat6[,-17:-22]
View(achats7)
achats8 <- achats7[,-15]
View(achats8)
achat <- achats8
head(achat)
##   reference articles code tiers    type fact n° doucment abr document
## 1             ALLC05    F02FSP1 Facture cpta    FA011260          FA0
## 2             ALLC05    F02FSP1 Facture cpta    FA011452          FA0
## 3             ALLC05    F02FSP1 Facture cpta    FA011010          FA0
## 4             ALLE01    F02FSP1 Facture cpta    FA012302          FA0
## 5             ALLE01    F0GEEX1 Facture cpta    FA005462          FA0
## 6             ALLE01    F0GEEX1 Facture cpta    FA002074          FA0
##     type document       date                  désignations qtés prix unitaire
## 1 Facture d'achat 2024-05-21 ALLUMETTE CHEF PARISIEN 12*12    1      22500.00
## 2 Facture d'achat 2024-05-29 ALLUMETTE CHEF PARISIEN 12*12    1      22500.00
## 3 Facture d'achat 2024-05-08 ALLUMETTE CHEF PARISIEN 12*12    1      22500.00
## 4 Facture d'achat 2024-08-20          ALLUMETTE EPIQ 12*12    2      22000.00
## 5 Facture d'achat 2022-09-21          ALLUMETTE EPIQ 12*12 1600      24200.00
## 6 Facture d'achat 2022-01-20          ALLUMETTE EPIQ 12*12 1587      21303.45
##   montant total % remise montant remise montant net fa_codefamille ar_uniteven
## 1         22500     <NA>              0       22500            BAZ           4
## 2         22500     <NA>              0       22500            BAZ           4
## 3         22500     <NA>              0       22500            BAZ           4
## 4         44000     <NA>              0       44000            BAZ           1
## 5      38720000     <NA>              0    38720000            BAZ           1
## 6      33808575     <NA>              0    33808575            BAZ           1
##   ar_prixach ar_prixven
## 1      22500      22700
## 2      22500      22700
## 3      22500      22700
## 4      21303      22800
## 5      21303      22800
## 6      21303      22800