Announcement

Collapse
No announcement yet.

programing help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    programing help

    i am trying to program a project in pascal and i have hit a problem

    the first one is that i am able to search for the client and i am able to display the content but when i want to display them again i cant seem to be able to do that.

    the second problem is that i am able to do split screen (procedure left and right) but i cant seem to be able to get the normal screen after the procedures have been used. when i exit to main menu the screen is still split.

    the listng:

    program one;

    uses
    crt;

    type
    string3 = string[3];
    string4 = string[4];
    string5 = string[5];
    string9 = string[9];
    string10 = string[10];
    string12 = string[12];
    string13 = string[13];
    string20 = string[20];
    string25 = string[25];
    string30 = string[30];
    string40 = string[40];
    string80 = string[80];
    string100 = string[100];
    string255 = string[255];

    crec = record
    cref : string4;
    ctitle : string4;
    csurname : string30;
    cfname : string25;
    caddress : string40;
    cpcode : string9;
    cpartnership : string3;
    cshare : string5;
    ctitle2 : string4;
    csurname2 : string30;
    cfname2 : string25;
    caddress2 : string40;
    cpcode2 : string9;
    cpartnership2 : string3;
    cshare2 : string5;
    cbname : string20;
    cbaddress : string40;
    cbpcode : string9;
    cbtel : string13;
    cbfax : string13;
    ccomment : string100;


    end;

    prec = record
    pref : string5;
    pcref : string4;
    pdate : string10;
    pcharges : string255;
    end;

    urec = record

    uref : string5;
    ucref : string4;
    udate : string10;
    ucharges : string255;
    end;

    const
    space = ' ';
    vatno = '250 376 825';

    var
    clientrec : crec;
    clientfile : file of crec;
    paidrec : prec;
    paidfile : file of prec;
    unpaidrec : urec;
    unpaidfile : file of urec;
    clientref2 : string;
    surname : string;
    title : string;
    businessname : string;
    businessaddress : string;
    businesspcode : string;
    mainselect : char;
    adminselect : char;
    madminselect : char;
    customerselect : char;
    queryselect : char;
    numc : integer;
    clientref : array[0..10] of string4;
    clienttitle : array[0..10] of string4;
    clientsurname : array[0..10] of string30;
    clientfname : array[0..10] of string25;
    clientaddress : array[0..10] of string40;
    clientpcode : array[0..10] of string9;
    clientpartnership : array[0..10] of string3;
    clientshare : array[0..10] of string5;
    clienttitle2 : array[0..10] of string4;
    clientsurname2 : array[0..10] of string30;
    clientfname2 : array[0..10] of string25;
    clientaddress2 : array[0..10] of string40;
    clientpcode2 : array[0..10] of string9;
    clientpartnership2 : array[0..10] of string3;
    clientshare2 : array[0..10] of string5;
    clientbname : array[0..10] of string20;
    clientbaddress : array[0..10] of string40;
    clientbpcode : array[0..10] of string9;
    clientbtel : array[0..10] of string13;
    clientbfax : array[0..10] of string13;
    clientcomment : array[0..10] of string100;

    nump : integer;
    paidref : array[0..10] of string5;
    paidcref : array[0..10] of string4;
    paiddate : array[0..10] of string10;
    paidcharges : array[0..10] of string255;

    numu : integer;
    unpaidref : array[0..10] of string5;
    unpaidcref : array[0..10] of string4;
    unpaiddate : array[0..10] of string10;
    unpaidcharges : array[0..10] of string255;



    procedure left;
    begin
    window(1,11,60,50);
    textbackground(green);
    textcolor(white);
    end;

    procedure right;
    begin
    window(61,11,79,50);
    textbackground(red);
    textcolor(white);
    end;


    procedure createinvoice;

    var
    client : string;
    top,bottom,mid : integer;
    confirm : char;
    amendment : string;
    fig1 : string;
    fig2 : string;
    fig3 : string;
    fig4 : string;
    t1 : string;
    t2 : string;
    t3 : string;
    t4 : string;
    h1 : string;
    h2 : string;
    h3 : string;
    h4 : string;
    total: string;
    if1 : integer;
    if2 : integer;
    if3 : integer;
    if4 : integer;
    it1 : integer;
    it2 : integer;
    it3 : integer;
    it4 : integer;
    ih1 : integer;
    ih2 : integer;
    ih3 : integer;
    ih4 : integer;
    check : integer;
    xleft,yleft : integer;
    xright,yright : integer;

    begin
    textbackground(blue);
    clrscr;
    textcolor(white);
    writeln;
    writeln;
    writeln;
    writeln(space:25,' SEARCH FOR CLIENT''S DETAILS');
    writeln;
    writeln(space:25,'=================');
    writeln;
    writeln;
    write(space:10,'Enter reference number of client to produce invoice : ');
    readln(client);
    top := numc;
    bottom := 0;
    repeat
    mid := trunc((top+bottom)/2);
    if client < clientref[mid] then
    top := mid - 1;
    if client > clientref[mid] then
    bottom := mid + 1;
    until (client = clientref[mid]) or (top < bottom);
    if client = clientref[mid] then
    begin
    writeln;

    writeln(space:10,'Client details');
    writeln(space:10,'==============');
    writeln;
    writeln(space:10,clientref[mid]);
    writeln(space:10,clienttitle[mid]);
    writeln(space:10,clientsurname[mid]);
    writeln(space:10,clientfname[mid]);
    writeln(space:10,clientaddress[mid]);
    writeln(space:10,clientpcode[mid]);
    writeln(space:10,clientpartnership[mid]);
    writeln(space:10,clientshare[mid]);
    writeln(space:10,clienttitle2[mid]);
    writeln(space:10,clientsurname2[mid]);
    writeln(space:10,clientfname2[mid]);
    writeln(space:10,clientaddress2[mid]);
    writeln(space:10,clientpcode2[mid]);
    writeln(space:10,clientpartnership2[mid]);
    writeln(space:10,clientshare2[mid]);
    writeln(space:10,clientbname[mid]);
    writeln(space:10,clientbaddress[mid]);
    writeln(space:10,clientbpcode[mid]);
    writeln(space:10,clientbtel[mid]);
    writeln(space:10,clientbfax[mid]);
    writeln(space:10,clientcomment[mid]);
    i am able to display the stuff here but i cant further down.


    writeln;
    repeat
    write(space:4,'Please confirm if you wish to create an invoice for this client Y/N : ');
    confirm := readkey;
    until (confirm='Y') or (confirm='y') or (confirm='N') or (confirm='n');
    if (confirm='Y') or (confirm='y') then
    begin

    textbackground(blue);
    textcolor(white);
    clrscr;
    writeln;
    writeln(space:6,clientbname[mid]);
    writeln(space:6,clienttitle[mid],' ',);
    writeln(space:6,clientbaddress[mid]);
    writeln(space:6,clientbpcode[mid]);
    writeln;

    writeln(space:6,'PLEASE ENTER THE HOURLY RATE AND NUMBER OF HOURS SPENT ON SERVICES');
    writeln;
    writeln(space:6,'Service provided Rate per hour Hours spent ');
    writeln(space:6,'---------------- ------------- ----------- ');
    writeln(space:46,' () ');

    left;
    writeln;
    writeln;
    write(space:6,'1. Bookkeeping : ');
    readln(h1);
    xleft := wherex;
    yleft := wherey;
    right;
    writeln;
    writeln;
    write(space:2,' : ');
    readln(t1);
    xright := wherex;
    yright := wherey;
    val(h1,ih1,check);
    val(t1,it1,check);
    if1 := it1 * ih1;
    str(if1,fig1);
    left;
    gotoxy(xleft,yleft);
    writeln;writeln;
    writeln(space:6,'The value is : ',fig1);

    readln;

    i want to be able to go to normal screen here

    end;
    end
    else
    begin
    writeln(chr(7));
    textbackground(red);
    clrscr;
    textcolor(white+blink);
    gotoxy(17,12);
    writeln('NO SUCH MEMBER REF NUMBER EXISTS!');
    gotoxy(17,15);
    writeln('Please check the number again');
    delay(1000)
    end;
    end;

    #2
    :rotato:

    Comment


      #3
      Sorry, but I only do VB and T-SQL
      Muslims are so good at dividing that they can divide the atom. If you see two Muslims, probably they belong to 3 parties.
      Al-Ghazali

      Comment


        #4
        yaar find someone plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

        warna i am dead meat, its somehting very simple, some one who knows pascal would know it. its just that its holidays and i was hoping to do programing b4 they end

        Comment


          #5
          isn't pascal obeselete or something, plus no one has the time to go through all these spaghetti code. You are going to have to be more precise where the problem exists..

          Comment


            #6
            When you want to go back to full screen, why don't you try to call the window () again with full screen attributes.

            Window (1,1,80,25) ;
            textbackground(Black);
            textcolor(white);
            "A woman has got to be able to say, and not feel guilty, 'Who am I, and what do I want out of life?' She mustn't feel selfish and neurotic if she wants goals of her own, outside of husband and children"

            Comment


              #7
              Re: programing help

              Originally posted by waleed:
              textbackground(blue);
              textcolor(white);
              clrscr;
              writeln;
              writeln(space:6,clientbname[mid]);
              writeln(space:6,clienttitle[mid],' ',);
              writeln(space:6,clientbaddress[mid]);
              writeln(space:6,clientbpcode[mid]);
              writeln;
              What is the value of mid before this group of statements is executed?

              Also what is the value of mid after a match is found?
              "A woman has got to be able to say, and not feel guilty, 'Who am I, and what do I want out of life?' She mustn't feel selfish and neurotic if she wants goals of her own, outside of husband and children"

              Comment


                #8
                ok thanx for the helping statment ppl i have found the solution to one my self and the other thanx to aishaA je. well partly a solution for now until i talk to my stupied teacher .

                and outlaw je yes it is very old but its is used because its good for teaching basics to students. i am not in uni yet ....where they teach c++ or java.

                Comment


                  #9
                  say wht?

                  Comment


                    #10
                    Originally posted by waleed:
                    ok thanx for the helping statment ppl i have found the solution to one my self and the other thanx to aishaA je. well partly a solution for now until i talk to my stupied teacher .

                    and outlaw je yes it is very old but its is used because its good for teaching basics to students. i am not in uni yet ....where they teach c++ or java.
                    yaar waleed uni mein java aur c++ se pehlay programming basics seekhnay k liye pascal parhatay hain ...keep goin man ham ne bhi yeh bohat saha hai....pascal mein hamein sab se pehlee problem divide by zero k error se aai thee i hope tumko woh prob pesh nahin aai hogee...well ne ways kahan parh rahay ho .....

                    Comment


                      #11
                      thanx acha dost je i got my probs sorted out

                      brain masala

                      Comment

                      Working...
                      X