In glycolysis $4$ ATP and $2 NADH _{2}$ molecules are formed. These $2 NADH _{2}$ molecules go to electron transport chain.
In oxidative decarboxylation no $ATP$ molecule is formed but two molecules of $NADH _{2}$ are formed from two molecules of pyruvate. These two $NADH _{2}$ go to electron transport chain. In Krebs cycle $2 \,ATP , 6 \,NADH _{2}$ and $2 \, FADH _{2}$ molecules are formed from two molecule of acetyl Co-A. These $NADH _{2}$ and $FADH _{2}$ go to electron transport chain. In electron transport chain all $NADH _{2}$ and $FADH _{2}$ pass to electron carriers and yield $3 \,ATP$ and $2 \,ATP$ molecules per $NADH _{2}$ and $FADH _{2}$ respectively.
Thus,
$4 \,ATP$ are formed in glycolysis
$2 \,ATP$ in Krebs cycle and
$34 \,ATP$ from electron transport chain
$40 \,ATP$
$2 \,ATP$ molecules are used during glycolysis.
So, net gain of $ATP$ molecules during one complete oxidation of a glucose molecule is $38 \,ATP$.