Guest User

Untitled

a guest
Mar 24th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.94 KB | None | 0 0
  1. //By MRZ
  2.  
  3.  
  4. #include<stdio.h>
  5. #include<stdlib.h>
  6. #include<conio.h>
  7. #include<iostream>
  8. #include<string.h>
  9. using namespace std;
  10.  
  11.  
  12. void menu();
  13. void clientes();
  14. void crear_cli();
  15. void listar_cli();
  16. void modificar_cli();
  17.  
  18. void productos();
  19. void crear_producto();
  20. void listar_producto();
  21. void modificar_producto();
  22.  
  23. void facturas();
  24. void crear_facturas();
  25. void listar_facturas();
  26.  
  27.  
  28.  
  29. struct cliente{
  30. char nombre[20];
  31. char id[10];
  32. char direccion[50];
  33. unsigned long tel;
  34. }cli[3] , *pcli=cli;
  35.  
  36. struct factura{
  37. char id[3], producto[100],cliente[10];
  38. int cant, disp;
  39. bool pago,nopago;
  40.  
  41. }factura[5],*pfactura=factura;
  42.  
  43.  
  44. struct productos{
  45.  
  46. char codigo[3];
  47. char nom[30];
  48. char valor[20];
  49.  
  50. }producto[10],*pproducto=producto;
  51.  
  52. int opc,cantidad_cli,cantidad_product,cantidad_fact,i;
  53.  
  54.  
  55. int id[10],codigo[3];
  56.  
  57.  
  58. void encabezado()
  59. {
  60.  
  61. printf("\n\t |---------------------------------------------| ");
  62. printf("\n\t | CARTAGO VALLE SUPER INTER LO MEORXITO | ");
  63. printf("\n\t | WHATTAPP:314621195 | ");
  64. printf("\n\t | FIJO:2111316 | ");
  65. printf("\n\t |---------------------------------------------| ");
  66. }
  67.  
  68.  
  69.  
  70. void menu(){
  71. int opc = 0;
  72. do{
  73. printf("\n\t\t|-----------------------------------------|");
  74. printf("\n\t\t| FACTURACION |");
  75. printf("\n\t\t|------------------|----------------------|");
  76. printf("\n\t\t| | |");
  77. printf("\n\t\t| 1. CLIENTES | 2. PRODUCTOS |");
  78. printf("\n\t\t| | |");
  79. printf("\n\t\t| 3.FACTURAS | 0. CERRAR |");
  80. printf("\n\t\t| | |");
  81. printf("\n\t\t|------------------|----------------------|");
  82. printf("\n\t\t|-----------------------------------------|");
  83. printf("\n\n\t\t\t ESCOJA UNA OPCION: ");
  84. printf("\n\n ");
  85. scanf("%d",&opc);
  86.  
  87.  
  88. switch(opc){
  89. case 0:
  90. system("cls");
  91. printf("í GRACIAS POR PREFERIRNOS !\n");
  92. exit(0);
  93. case 1:
  94. system("cls");
  95. clientes();
  96. break;
  97. case 2:
  98. system("cls");
  99. productos();
  100. break;
  101. case 3:
  102. system("cls");
  103. facturas();
  104. break;
  105.  
  106. default:
  107. system("cls");
  108. printf("\n\n");
  109. printf("\t\t LA OPCION INGRESADA ES INVALIDA!!\n");
  110. printf("\n\n");
  111. printf("\t\t DIGITE UNA OPCION VALIDA ");
  112. printf("\n\n");
  113. }
  114. }while(opc != 0);
  115. }
  116.  
  117. void clientes(){
  118.  
  119.  
  120.  
  121. do{
  122. printf("\n |------------------------------------------|");
  123. printf("\n |-------- CLIENTES ---------|");
  124. printf("\n |-------------------|----------------------|");
  125. printf("\n | | |");
  126. printf("\n | 1. CREAR | 2. LISTAR |");
  127. printf("\n | 3. MODIFICAR | 0. CERRAR |");
  128. printf("\n | | |");
  129. printf("\n | | |");
  130. printf("\n | | |");
  131. printf("\n |-------------------|----------------------|");
  132. printf("\n |------------------------------------------|");
  133. printf("\n\n\t\t\t ESCOJA UNA OPCION: ");
  134. printf("\n\n ");
  135. scanf("%d", &opc);
  136. switch(opc){
  137. case 0:
  138. system("cls");
  139. menu();
  140. case 1:
  141. system("cls");
  142. crear_cli();
  143. break;
  144. case 2:
  145. system("cls");
  146. listar_cli();
  147. break;
  148. case 3:
  149. system("cls");
  150. modificar_cli();
  151. break;
  152.  
  153. default:
  154. system("cls");
  155. printf("\n\n");
  156. printf("\t\t LA OPCION INGRESADA ES INVALIDA!!\n");
  157. printf("\n\n");
  158. printf("\t\t DIGITE UNA OPCION VALIDA ");
  159. printf("\n\n");
  160. }
  161. }while(opc != 0);
  162.  
  163. }
  164.  
  165.  
  166.  
  167.  
  168. void crear_cli(){
  169. system("cls");
  170.  
  171. printf("\t\t OPCION 1: CREAR CLIENTES\n\n");
  172. fflush(stdin);
  173. printf("\n\nCantidad De Clientes : ");
  174. scanf("%d",&cantidad_cli);
  175. for(int i=0;i<cantidad_cli;i++){
  176. printf("\nDatos Del Cliente:");
  177. fflush(stdin);
  178. printf("\n\nNombre:");
  179. fgets((pcli + i) -> nombre, 30, stdin);
  180. printf("\nCedula del cliente:");
  181. fgets((pcli + i) -> id, 10, stdin);
  182. fflush(stdin);
  183. printf("\nDireccion:");
  184. fgets((pcli + i) -> direccion, 20, stdin);
  185. printf("\nTelefono :");
  186. scanf("%i",&(pcli + i) ->tel);
  187. fflush(stdin);
  188. }
  189.  
  190. system("cls");
  191.  
  192. }
  193.  
  194. void listar_cli(){
  195. for(int i=0;i<cantidad_cli;i++){
  196. printf("\n\nEl Nombre es:");
  197. printf("%s",(pcli + i) -> nombre);
  198. printf("\nLA Cedula del cliente es:");
  199. printf((pcli + i) -> id,10,stdin);
  200. printf("\nlA Direccion ES:");
  201. printf((pcli + i) -> direccion);
  202. printf("\nEL Telefono ES :");
  203. printf("%i",(pcli + i) ->tel);
  204.  
  205. printf("\n\n");
  206. }
  207. }
  208.  
  209. void modificar_cli(){
  210.  
  211. printf("\n\nQUE DESEAS MODIFICAR: ");
  212.  
  213. for( i=0;i<cantidad_cli;i++){
  214. printf("\n\nposicion[%1d]:",i);
  215. printf("\n\nEl Nombre es:");
  216. printf("%s",(pcli + i) -> nombre);
  217. printf("\nLa Cedula del cliente es:");
  218. printf((pcli + i) -> id,10,stdin);
  219. printf("\nLa Direccion ES:");
  220. printf((pcli + i) -> direccion);
  221. printf("\nEl Telefono ES :");
  222. printf("%i",(pcli + i) ->tel);
  223.  
  224. printf("\n\n");
  225. }
  226. scanf("%d", &opc);
  227. switch(opc){
  228.  
  229.  
  230. case 1:
  231. system("cls");
  232. fflush(stdin);
  233. printf("\n\nNombre:");
  234. fgets((pcli + i) -> nombre, 30, stdin);
  235. break;
  236. case 2:
  237. system("cls");
  238. printf("\nCedula del cliente:");
  239. fgets((pcli + i) -> id, 10, stdin);
  240. break;
  241. case 3:
  242. system("cls");
  243. printf("\nLa Direccion ES:");
  244. printf((pcli + i) -> direccion);
  245. break;
  246.  
  247. case 4:
  248. system("cls");
  249. printf("\nEl Telefono ES :");
  250. printf("%i",(pcli + i) ->tel);
  251.  
  252. default:
  253. system("cls");
  254. printf("\n\n");
  255. printf("\t\t LA OPCION INGRESADA ES INVALIDA!!\n");
  256. printf("\n\n");
  257. printf("\t\t DIGITE UNA OPCION VALIDA ");
  258. printf("\n\n");
  259. }
  260.  
  261.  
  262.  
  263. }
  264.  
  265.  
  266. void productos(){
  267.  
  268. int opc=0;
  269. do{
  270. printf("\n |------------------------------------------|");
  271. printf("\n |-------- PRODUCTOS ---------|");
  272. printf("\n |-------------------|----------------------|");
  273. printf("\n | | |");
  274. printf("\n | 1. CREAR | 2. LISTAR |");
  275. printf("\n | 3. MODIFICAR | 0. CERRAR |");
  276. printf("\n | | |");
  277. printf("\n | | |");
  278. printf("\n | | |");
  279. printf("\n |-------------------|----------------------|");
  280. printf("\n |------------------------------------------|");
  281. printf("\n\n\t\t\t ESCOJA UNA OPCION: ");
  282. printf("\n\n ");
  283. scanf("%d", &opc);
  284. switch(opc){
  285. case 0:
  286. system("cls");
  287. menu();
  288. case 1:
  289. system("cls");
  290. crear_producto();
  291. break;
  292. case 2:
  293. system("cls");
  294. listar_producto();
  295. break;
  296. case 3:
  297. system("cls");
  298. modificar_producto();
  299. break;
  300.  
  301. default:
  302. system("cls");
  303. printf("\n\n");
  304. printf("\t\t LA OPCION INGRESADA ES INVALIDA!!\n");
  305. printf("\n\n");
  306. printf("\t\t DIGITE UNA OPCION VALIDA ");
  307. printf("\n\n");
  308. }
  309. }while(opc != 0);
  310.  
  311. }
  312.  
  313.  
  314.  
  315. void crear_producto(){
  316. printf("\n\n1.OPCION:CREAR PRODUCTO\n\n");
  317. fflush(stdin);
  318. printf("\n\nNumeros de productos :");
  319. scanf("%d",&cantidad_product);
  320. for(int i=0;i<cantidad_product;i++){
  321. printf("\n\n Nombre del producto:");
  322. fflush(stdin);
  323. fgets((pproducto+i)->nom,30,stdin);
  324. printf("\nCodigo del producto:");
  325. fgets((pproducto+i)->codigo,10,stdin);
  326. printf("\nValor del producto:");
  327. fgets((pproducto+i)->valor,10,stdin);
  328.  
  329. fflush(stdin);
  330.  
  331. }
  332. }
  333.  
  334.  
  335.  
  336. void modificar_producto(){
  337.  
  338. printf("\n\nQUE DESEAS MODIFICAR: ");
  339.  
  340. for( i=0;i<cantidad_product;i++){
  341. printf("\n\nposicion[%1d]:",i);
  342. printf("\n\nNombre del producto es:");
  343. printf("%s",(pproducto+i)->nom,30);
  344. printf("\nCodigo del producto es:");
  345. printf((pproducto+i)->codigo,10,stdin);
  346. printf("\nValor del producto es:");
  347. printf((pproducto+i)->valor,10,stdin);
  348.  
  349. printf("\n\n");
  350.  
  351. }
  352. }
  353.  
  354.  
  355.  
  356.  
  357.  
  358. void listar_producto(){
  359. for(int i=0;i<cantidad_product;i++){
  360. printf("\n\n Nombre del producto es:");
  361. printf((pproducto+i)->nom);
  362.  
  363. printf("\nCodigo del producto es:");
  364. printf((pproducto+i)->codigo,10,stdin);
  365. printf("\nValor del producto es:");
  366. printf((pproducto+i)->valor,10,stdin);
  367.  
  368. printf("\n\n");
  369.  
  370. }
  371.  
  372. }
  373.  
  374.  
  375.  
  376.  
  377.  
  378. void facturas(){
  379.  
  380.  
  381. int opc=0;
  382. do{
  383. printf("\n |------------------------------------------|");
  384. printf("\n |-------- FACTURAS ---------|");
  385. printf("\n |-------------------|----------------------|");
  386. printf("\n | | |");
  387. printf("\n | 1. CREAR | 2. LISTAR |");
  388. printf("\n | | 0. CERRAR |");
  389. printf("\n | | |");
  390. printf("\n | | |");
  391. printf("\n | | |");
  392. printf("\n |-------------------|----------------------|");
  393. printf("\n |------------------------------------------|");
  394. printf("\n\n\t\t\t ESCOJA UNA OPCION: ");
  395. printf("\n\n ");
  396. scanf("%d", &opc);
  397. switch(opc){
  398. case 0:
  399. system("cls");
  400. menu();
  401. case 1:
  402. system("cls");
  403. crear_facturas();
  404. break;
  405. case 2:
  406. system("cls");
  407. listar_facturas();
  408. break;
  409.  
  410. default:
  411. system("cls");
  412. printf("\n\n");
  413. printf("\t\t LA OPCION INGRESADA ES INVALIDA!!\n");
  414. printf("\n\n");
  415. printf("\t\t DIGITE UNA OPCION VALIDA ");
  416. printf("\n\n");
  417. }
  418. }while(opc != 0);
  419.  
  420. }
  421.  
  422.  
  423.  
  424.  
  425.  
  426. void crear_facturas(){
  427. int i=0;
  428.  
  429. int pago;
  430. system("cls");
  431. printf("\t CREAR FACTURA\n\n");
  432. fflush(stdin);
  433. printf("\n\nNumeros de facturas :");
  434. scanf("%i",&cantidad_fact);
  435. for(int i=0;i<cantidad_fact;i++){
  436. printf("\n producto: #%d",i+1);
  437. fflush(stdin);
  438. printf("\n Codigo del producto:");
  439. fgets((pfactura+i)->id,10,stdin);
  440. printf("\n Descripcion del producto:");
  441. fgets((pfactura+i)->producto,10,stdin);
  442. printf("\nCodigo del cliente:");
  443. fgets((pfactura+i)->cliente,10,stdin);
  444. printf("\n Cantidad en letras:");
  445. scanf("%i",&(pfactura+i)->cant);
  446. fflush(stdin);
  447. printf("\nEstado (si esta paga ingresa 1, de lo contrario 2):");
  448. scanf("%d",&(pfactura+i)->pago);
  449. fflush(stdin);
  450. printf("\n\nconfirmar nuevamente la OPCION: ");
  451. scanf("%d", &opc);
  452. switch(opc){
  453. case 1:
  454. system("cls");
  455. printf("La factura esta paga \n");
  456. break;
  457. case 2:
  458. system("cls");
  459. printf("La factura no esta paga \n");
  460. break;
  461. }
  462.  
  463.  
  464. getch();
  465. }
  466. }
  467. void listar_facturas(){
  468. for(int i=0;i<cantidad_fact;i++){
  469. printf("\n\nCodigo del producto:");
  470. printf((pfactura+i)->id);
  471. printf("\nDescripcion del producto:");
  472. printf((pfactura+i)->producto);
  473. printf("\nCodigo del cliente:");
  474. printf((pfactura+i)->cliente);
  475. printf("\n Cantidad:");
  476. printf("%d",(pfactura+i)->cant);
  477. printf("\n Estado:");
  478. printf("%d",(pfactura+i)->pago);
  479.  
  480. printf("\n\n");
  481. }
  482.  
  483.  
  484. }
  485.  
  486.  
  487.  
  488.  
  489. void salir(){
  490. system("cls");
  491. printf("\n\n\t\t\tí GRACIAS POR PREFERIRNOS !");
  492.  
  493. getch();
  494.  
  495. }
  496.  
  497. int main(){
  498. encabezado();
  499. menu();
  500. clientes();
  501. //crear_cli(int) ;
  502. listar_cli();
  503. modificar_cli();
  504.  
  505. productos();
  506. crear_producto();
  507. listar_producto();
  508. modificar_producto();
  509.  
  510. facturas();
  511. crear_facturas();
  512. listar_facturas();
  513.  
  514.  
  515.  
  516. system("pause");
  517. return 0;
  518. }
Add Comment
Please, Sign In to add comment