سورس سیستم مدیریت فروش به زبان سی پلاس پلاس :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 |
#include<iostream.h> #include<fstream.h> #include<stdio.h> #include<conio.h> #include<string.h> #include<dos.h> #include<iomanip.h> #include<ctype.h> #include<stdlib.h> struct date_rec { short int day; short int month; int year; }current_date; struct node { int rec_no; node *link; }; node *start,*ptr; class item_list { private: int item_code,qty_in_stock; //item code and quantity in stock char item_name[30]; float item_rate; public: item_list() //no argument constructor { item_code=0; memset(item_name,0,30); item_rate=0.0; qty_in_stock=0; } void get_item(); //this function reads the private member of item file int vallidate(int item_code,int qty); //this function verifies item code correponding qty in stock float update_on_sale(int ic1,int ic2,int ic3,int ic4,int ic5, int iq1,int iq2,int iq3,int iq4,int iq5); //this function updates the qty whenever item is purchased void update_on_purchase(item_list temp_item); void purchase_order(); //to generate purchase order list if stock is less than 20 node* create_list(); //create an index of objects void items_available(); //display the item available }item; //object list // this class defines the data and member function related to // sales of an item. class sales_list { private: int cash_memo_num; date_rec cash_memo_date; int item_code1,i_qty1; int item_code2,i_qty2; int item_code3,i_qty3; int item_code4,i_qty4; int item_code5,i_qty5; float total_amount; public: char ch; sales_list() // constructor { item_code1=i_qty1=0; item_code2=i_qty2=0; item_code3=i_qty3=0; item_code4=i_qty4=0; item_code5=i_qty5=0; total_amount=0.0; } // this function checks for availability of an item and its quantity int vallidate_item(int item_code,int qty); // this function generates record number automatically int get_memo_no(struct date_rec current_date); // this function collects information to prepare cash memo void get_chmo_info(); void show_data(); // this function displays data // this function adds a record to the master file void update_sales_file(int memo_num,int ic1,int ic2,int ic3,int ic4,int ic5, int iq1,int iq2,int iq3,int iq4,int iq5,float amount); void daily_sales_report(struct date_rec current_date); }cash_memo; // object list // DECLARING MEMBER FUNCTIONS HERE // this member function reads the private members of class itemfile void item_list::get_item() { gotoxy(20,5); cout<<"ENTER THE ITEM CODE ------------>"; cin>>item_code; gotoxy(20,6); cout<<"ENTER THE ITEM NAME ------------>"; gets(item_name); gotoxy(20,7); cout<<"ENTER THE ITEM RATE ------------>"; cin>>item_rate; gotoxy(20,8); cout<<"ENTER THE QUANTITY ------------->"; cin>>qty_in_stock; } // this member function enters a new item in itemfile, calls get_item(); void item_list::update_on_purchase(item_list temp_item) { fstream item_file; //item.get_item(); item_file.open("itemfile.dat",ios::app | ios::in | ios::out); // open file in append mode int found=0; item_file.seekg(0); item_file.read((char*)&item,sizeof(item)); int n=item_file.tellg(); while(!item_file.eof()) { if(item.item_code==temp_item.item_code) { item.item_rate=temp_item.item_rate; item.qty_in_stock=item.qty_in_stock+temp_item.qty_in_stock; item_file.seekg(n-sizeof(item)); item_file.write((char*)&item,sizeof(item)); found=1; } item_file.read((char*)&item,sizeof(item)); // write in the file n=item_file.tellg(); } item_file.close(); if(found==0) { item_file.open("itemfile.dat",ios::out); item_file.seekg(0,ios::end); item_file.write((char*)&temp_item,sizeof(temp_item)); item_file.close(); } } int item_list::vallidate(int i_code,int i_qty) { item_list temp_item; fstream item_file; int ret=0; item_file.open("itemfile.dat",ios::in); item_file.seekg(0); item_file.read((char*)&temp_item,sizeof(temp_item)); while(!item_file.eof()) { if(temp_item.item_code==i_code&&temp_item.qty_in_stock>=i_qty) ret=1; item_file.read((char*)&temp_item,sizeof(temp_item)); } item_file.close(); return ret; } float item_list::update_on_sale(int ic1,int ic2,int ic3,int ic4,int ic5, int iq1,int iq2,int iq3,int iq4,int iq5) { fstream item_file; float amount=0; item_file.open("itemfile.dat",ios::in); item_file.seekg(0); item_file.read((char*)&item,sizeof(item)); int n=item_file.tellg(); while(!item_file.eof()) { if(item.item_code==ic1) { if(item.vallidate(ic1,iq1)) { gotoxy(59,9); cout<<setiosflags(ios::fixed) <<setiosflags(ios::showpoint) <<setprecision(2) <<item.item_rate; item.qty_in_stock=item.qty_in_stock-iq1; if(item.qty_in_stock<=0) item.qty_in_stock=0; amount=amount+(item.item_rate*iq1); item_file.seekg(n-sizeof(item)); item_file.write((char*)&item,sizeof(item)); } else { gotoxy(59,9); cout<<"NOT AVAILABLE"; } } if(item.item_code==ic2) { if(item.vallidate(ic2,iq2)) { gotoxy(59,10); cout<<setiosflags(ios::fixed) <<setiosflags(ios::showpoint)<<setprecision(2)<<item.item_rate; item.qty_in_stock=item.qty_in_stock-iq2; if(item.qty_in_stock<=0) item.qty_in_stock=0; amount=amount+(item.item_rate*iq2); item_file.seekg(n-sizeof(item)); item_file.write((char*)&item,sizeof(item)); } else { gotoxy(59,10); cout<<"NOT AVAILABLE"; } } if(item.item_code==ic3) { if(item.vallidate(ic3,iq3)) { gotoxy(59,11); cout<<setiosflags(ios::fixed) <<setiosflags(ios::showpoint)<<setprecision(2)<<item.item_rate; item.qty_in_stock=item.qty_in_stock-iq3; if(item.qty_in_stock<=0) item.qty_in_stock=0; amount=amount+(item.item_rate*iq3); item_file.seekg(n-sizeof(item)); item_file.write((char*)&item,sizeof(item)); } else { gotoxy(59,11); cout<<"NOT AVAILABLE"; } } if(item.item_code==ic4) { if(item.vallidate(ic4,iq4)) { gotoxy(59,12); cout<<setiosflags(ios::fixed) <<setiosflags(ios::showpoint) <<setprecision(2) <<item.item_rate; item.qty_in_stock=item.qty_in_stock-iq4; if(item.qty_in_stock<=0) item.qty_in_stock=0; amount=amount+(item.item_rate*iq4); item_file.seekg(n-sizeof(item)); item_file.write((char*)&item,sizeof(item)); } else { gotoxy(59,12); cout<<"NOT AVAILABLE"; } } if(item.item_code==ic5) { if(item.vallidate(ic5,iq5)) { gotoxy(59,13); cout<<setiosflags(ios::fixed) <<setiosflags(ios::showpoint) <<setprecision(2) <<item.item_rate; item.qty_in_stock=item.qty_in_stock-iq5; if(item.qty_in_stock<=0) item.qty_in_stock=0; amount=amount+(item.item_rate*iq5); item_file.seekg(n-sizeof(item)); item_file.write((char*)&item,sizeof(item)); } else { gotoxy(59,13); cout<<"NOT AVAILABLE"; } } item_file.read((char*)&item,sizeof(item)); n=item_file.tellg(); } item_file.close(); return amount; } void item_list::purchase_order() { fstream item_file; int found=0; gotoxy(20,2); cout<<"PURCHASE ORDER LIST ON:"<<current_date.day<<"-"<< current_date.month<<"-"<<current_date.year; gotoxy(20,3); cout<<"--------------------------------------"; gotoxy(22,5); cout<<"ITEM CODE"; gotoxy(22,6); cout<<"--------------------"; gotoxy(40,5); cout<<"CURRENT STOCK"; gotoxy(40,6); cout<<"--------------------"; int y=7; item_file.open("itemfile.date",ios::in); item_file.seekg(0); item_file.read((char*)&item,sizeof(item)); while(!item_file.eof()) { if(item.qty_in_stock) { gotoxy(25,y); cout<<item.item_code; gotoxy(43,y); cout<<item.qty_in_stock; y++; found=1; } item_file.read((char*)&item,sizeof(item)); } item_file.close(); if(found==0) { gotoxy(15,15); cout<<"NONE OF THE ITEMS ARE LESS THAN 20 IN STOCK"; gotoxy(20,16); cout<<"NO PURCHASE ORDER"; } } node*item_list::create_list() { fstream item_file; item_file.open("itemfile.dat",ios::in); item_file.seekg(0); start=ptr=new node; item_file.read((char*)&item,sizeof(item)); while(!item_file.eof()) { ptr->rec_no=item.item_code; ptr->link=new node; ptr=ptr->link; item_file.read((char*)&item,sizeof(item)); } ptr->link=NULL; item_file.close(); return start; } void item_list::items_available() { fstream item_file; clrscr(); gotoxy(20,2); cout<<"ITEM AVAILABLE"; gotoxy(20,3); cout<<"--------------"; gotoxy(10,5); cout<<"ITEM CODE"; gotoxy(10,6); cout<<"---------"; gotoxy(20,5); cout<<"STOCK"; gotoxy(20,6); cout<<"-----"; gotoxy(30,5); cout<<"ITEM NAME"; gotoxy(30,6); cout<<"---------"; gotoxy(40,5); cout<<"ITEM RATE"; gotoxy(40,6); cout<<"---------"; int y=7; item_file.open("itemfile.dat",ios::in); item_file.seekg(0); item_file.read((char*)&item,sizeof(item)); while(!item_file.eof()) { gotoxy(10,y); cout<<item.item_code; gotoxy(20,y); cout<<item.qty_in_stock; gotoxy(30,y); cout<<item.item_name; gotoxy(40,y); cout<<item.item_rate; y++; item_file.read((char*)&item,sizeof(item)); } item_file.close(); } int sales_list::get_memo_no(date_rec current_date) { fstream sales_file; int num; sales_file.open("cashmemo.dat",ios::in); sales_file.seekg(-sizeof(cash_memo),ios::end); sales_file.read((char*)&cash_memo,sizeof(cash_memo)); if (cash_memo.cash_memo_date.day==current_date.day &&cash_memo.cash_memo_date.month==current_date.month &&cash_memo.cash_memo_date.year==current_date.year) num=cash_memo_num+1; else num=1; sales_file.close(); return num; } //this function enters an new item into a itemfile, calls gets_item() void sales_list::update_sales_file(int memo_num,int ic1,int ic2, int ic3,int ic4,int ic5,int iq1,int iq2,int iq3,int iq4,int iq5,float amount) { fstream sales_file; cash_memo.cash_memo_num=memo_num; cash_memo.cash_memo_date=current_date; cash_memo.item_code1=ic1; cash_memo.item_code2=ic2; cash_memo.item_code3=ic3; cash_memo.item_code4=ic4; cash_memo.item_code5=ic5; cash_memo.i_qty1=iq1; cash_memo.i_qty2=iq2; cash_memo.i_qty3=iq3; cash_memo.i_qty4=iq4; cash_memo.i_qty5=iq5; cash_memo.total_amount=amount; sales_file.open("cashmemo.dat",ios::out | ios::app); //open file in attend mode sales_file.seekg(0,ios::end); sales_file.write((char*)&cash_memo,sizeof(cash_memo)); //write in the file sales_file.close(); //close file } void sales_list::daily_sales_report(struct date_rec current_date) { fstream sales_file; gotoxy(20,2); cout<<"------------------"; gotoxy(20,3); cout<<"SALES ON:"<<current_date.day<<"-"<<current_date.month<<" -" <<current_date.year; gotoxy(20,4); cout<<"---------------------------"; gotoxy(20,6); cout<<"ITEM CODE"; gotoxy(20,7); cout<<"-----------"; gotoxy(40,6); cout<<"QUANTITY SOLD"; gotoxy(40,7); cout<<"---------------"; int y=8; //sales_file.open("cashmemo.dat",ios::in); ptr=start; while(ptr->link!=NULL) { int qty=0; sales_file.open("cashmemo.dat",ios::in); sales_file.seekg(0,ios::beg); sales_file.read((char*)&cash_memo,sizeof(cash_memo)); while(!sales_file.eof()) { if(current_date.day==cash_memo_date.day&¤t_date.month== cash_memo_date.month&¤t_date.year==cash_memo_date.year) { if(ptr->rec_no==cash_memo.item_code1) qty=qty+cash_memo.i_qty1; if (ptr->rec_no==cash_memo.item_code2) qty=qty+cash_memo.i_qty2; if(ptr->rec_no==cash_memo.item_code3) qty=qty+cash_memo.i_qty3; if (ptr->rec_no==cash_memo.item_code4) qty=qty+cash_memo.i_qty4; if(ptr->rec_no==cash_memo.item_code5) qty=qty+cash_memo.i_qty5; } sales_file.read((char*)&cash_memo,sizeof(cash_memo)); } sales_file.close(); gotoxy(20,y); cout<<ptr->rec_no; gotoxy(40,y); cout<<qty; y++; ptr=ptr->link; } //sales_file.close(); } // MAIN FUNCTION void main() { char ch; int key,main_choice,valid=0; do { clrscr(); //clear screen if (valid!=0) { gotoxy(25,11); cout<<"INVALID DATE"; gotoxy(25,12); cout<<"PRESS ANY KEY TO TRY AGAIN"; getch(); clrscr(); } gotoxy(22,10); cout<<"ENTER CURRENT DATE(dd/mm/yyyy)"; gotoxy(25,11); cin>>current_date.day>>ch>>current_date.month>> ch>>current_date.year; valid=(current_date.day)||(current_date.day>31) ||(current_date.month>12)||(current_date.month<=0) ||(current_date.year=1998); //validate date }while(valid !=0); do { clrscr(); gotoxy(20,5); cout<<"ABC DEPARTMENTAL STORE"; gotoxy(20,7); cout<<"----------------"; gotoxy(20,7); cout<<"-----------------"; gotoxy(22,10); cout<<"SUPERVISOR ..........S"; gotoxy(22,12); cout<<"CASHMEMO ...........C"; gotoxy(22,14); cout<<"QUIT ...........Q"; main_choice=toupper(getch()); switch(main_choice) { case 'S':int s_choice; do { clrscr(); gotoxy(28,2); cout<<"---------------"; gotoxy(28,3); cout<<"SUPERVISOR MODE"; gotoxy(28,4); cout<<"----------------"; gotoxy(20,6); cout<<"UPDATE STOCK ON PURCHASE .....1"; gotoxy(20,8); cout<<"TODAY'S SALES REPORT .....2"; gotoxy(20,10); cout<<"LIST OF ITEM AVAILABLE .....3"; gotoxy(20,12); cout<<"PURCHASE ORDER LIST .....4"; gotoxy(20,14); cout<<"EXIT SUPERVISOR MODE .....5"; gotoxy(20,16); cout<<"ENTER YOUR CHOICE ----------------->"; cin>>s_choice; switch(s_choice) { case 1:int key; do { item_list temp_item; clrscr(); temp_item.get_item(); temp_item.update_on_purchase(temp_item); gotoxy(18,24); cout<<"CONTINUE:C QUIT:Q"; key=toupper(getch()); } while(key!='Q'); break; case 2: clrscr(); item.create_list(); cash_memo.daily_sales_report(current_date); getch(); break; case 3: item.items_available(); getch(); break; case 4: clrscr(); item.purchase_order(); getch(); break; case 5: break; } } while(s_choice !=5); break; case 'C': do { int memo_num; memo_num=cash_memo.get_memo_no(current_date); clrscr(); gotoxy(24,1); cout<<"------------------------------"; gotoxy(24,2); cout<<"ABC DEPARTMENTAL STORE"; gotoxy(24,3); cout<<"------------------------------"; gotoxy(30,5); cout<<"CASHMEMO"; gotoxy(30,6); cout<<"--------------------------------"; gotoxy(10,7); textbackground(RED+BLINK); cprintf("DATE:"); cout<<current_date.day<<"/"<<current_date.month<<"/" <<current_date.year; gotoxy(52,7); cout<<"NO:"<<memo_num; gotoxy(10,9); cout<<"ITEM CODE 1:"; gotoxy(35,9); cout<<"QTY:"; gotoxy(52,9); cout<<"RATE"; gotoxy(10,10); cout<<"ITEM CODE 2:"; gotoxy(35,10); cout<<"QTY:"; gotoxy(52,10); cout<<"RATE"; gotoxy(10,11); cout<<"ITEM CODE 3:"; gotoxy(35,11); cout<<"QTY:"; gotoxy(52,11); cout<<"RATE:"; gotoxy(10,12); cout<<"ITEM CODE 4:"; gotoxy(35,12); cout<<"QTY:"; gotoxy(52,12); cout<<"RATE:"; gotoxy(10,13); cout<<"ITEM CODE 5:"; gotoxy(35,13); cout<<"QTY:"; gotoxy(52,13); cout<<"RATE:"; gotoxy(10,15); cout<<"TOTAL AMOUNT:"; int ic1,ic2,ic3,ic4,ic5; int iq1,iq2,iq3,iq4,iq5; ic1=ic2=ic3=ic4=ic5=0; iq1=iq2=iq3=iq4=iq5=0; gotoxy(24,9); cin>>ic1; gotoxy(41,9); cin>>iq1; gotoxy(24,10); cin>>ic2; gotoxy(41,10); cin>>iq2; gotoxy(24,11); cin>>ic3; gotoxy(41,11); cin>>iq3; gotoxy(24,12); cin>>ic4; gotoxy(41,12); cin>>iq4; gotoxy(24,13); cin>>ic5; gotoxy(41,13); cin>>iq5; float total_amount=0; total_amount= total_amount=item.update_on_sale(ic1,ic2,ic3,ic4,ic5, iq1,iq2,iq3,iq4,iq5); gotoxy(25,15); cout<<setiosflags(ios::fixed) <<setiosflags(ios::showpoint) <<setprecision(2)<<total_amount; cash_memo.update_sales_file(memo_num,ic1,ic2,ic3,ic4, ic5,iq1,iq2,iq3,iq4,iq5,total_amount); gotoxy(22,24); cout<<"QUIT CASHMEMO:Q CONTINUE:C"; key=toupper(getch()); } while(key!='Q'); break; case'Q': exit(0); break; } } while(main_choice!='Q'); getch(); } |
راستی! برای دریافت مطالب جدید در کانال تلگرام یا پیج اینستاگرام سورس باران عضو شوید.
پکیج آموزش پروژه محور لاراول و طراحی وب سایت کانون قلم چی
دانلود با لینک مستقیم
- حجم فايل : 18 کیلوبایت
- منبع : سورس باران
- انتشار: ۲۷ آذر ۱۳۹۳
دسته بندی موضوعات
- آموزش ارز دیجیتال
- آموزش برنامه نویسی
- آموزش متنی برنامه نویسی
- اطلاعیه و سایر مطالب
- پروژه برنامه نویسی
- رپورتاژ
- فروشگاه
- فیلم های آموزشی
- ++C
- ADO.NET
- Adobe Flash
- Ajax
- AngularJS
- apache
- ARM
- Asp.Net
- ASP.NET MVC
- AVR
- Bootstrap
- CCNA
- CCNP
- CMD
- CSS
- Dreameaver
- EntityFramework
- Go
- HTML
- IOS
- jquery
- Linq
- Mysql
- Oracle
- PHP
- PHPMyAdmin
- Rational Rose
- silver light
- SQL Server
- Stimulsoft Reports
- Telerik
- UML
- VB.NET&VB6
- WPF
- Xml
- آموزش های پروژه محور
- اتوکد
- الگوریتم تقریبی
- امنیت
- اندروید
- اندروید استودیو
- بک ترک
- بیسیک فور اندروید
- پایتون
- جاوا
- جاوا اسکریپت
- جوملا
- دلفی
- دوره های رایگان پیشنهادی
- زامارین
- سئو
- ساخت CMS
- سی شارپ
- شبکه و مجازی سازی
- طراحی الگوریتم
- طراحی بازی
- طراحی وب
- فتوشاپ
- فریم ورک codeigniter
- فلاتر
- کانستراکت
- کریستال ریپورت
- لاراول
- معماری کامپیوتر
- مهندسی اینترنت
- هوش مصنوعی
- یونیتی
- کتاب های آموزشی
- Android
- ASP.NET
- AVR
- LINQ
- php
- Workflow
- اچ تی ام ال
- بانک اطلاعاتی
- برنامه نویسی سوکت
- برنامه نویسی موبایل
- پاسکال
- پایان نامه
- پایتون
- جاوا
- جاوا اسکریپت
- جی کوئری
- داده کاوی
- دلفی
- رباتیک
- سئو
- سایر کتاب ها
- سخت افزار
- سی اس اس
- سی پلاس پلاس
- سی شارپ
- طراحی الگوریتم
- فتوشاپ
- مقاله
- مهندسی نرم افزار
- هک و امنیت
- هوش مصنوعی
- ویژوال بیسیک
- نرم افزار و ابزار برنامه نویسی
- وردپرس
c++ how to program 4th رو برای دانلود بذارید فقط ویرایش چهار