| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 861 人关注过本帖
标题:求助:vc转tc .很难,希望有人帮助
只看楼主 加入收藏
redicehong
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2009-8-31
收藏
 问题点数:0 回复次数:2 
求助:vc转tc .很难,希望有人帮助

#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
USEFORM("main.cpp", fm_main);
USEFORM("data.cpp", dm_data); /* TDataModule: File Type */
USEFORM("name_gl.cpp", fm_name_gl);
USEFORM("jinhuo_gl.cpp", fm_jinhuo_gl);
USEFORM("lingshou.cpp", fm_lingshou_gl);
USEFORM("kucen.cpp", fm_kucen);
USEFORM("xiaoshou.cpp", fm_xiaoshou);
USEFORM("newname.cpp", fm_newname);
USEFORM("passwd.cpp", fm_passwd);
USEFORM("check.cpp", fm_check);
USEFORM("xiaopiao.cpp", fm_xiaopiao);
USEFORM("qingli.cpp", fm_qingli);
USEFORM("xiaoshoumx.cpp", fm_xiaoshoumx);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
        try
        {
                 Application->Initialize();
                 Application->CreateForm(__classid(Tfm_main), &fm_main);
         Application->CreateForm(__classid(Tdm_data), &dm_data);
         Application->CreateForm(__classid(Tfm_name_gl), &fm_name_gl);
         Application->CreateForm(__classid(Tfm_jinhuo_gl), &fm_jinhuo_gl);
         Application->CreateForm(__classid(Tfm_lingshou_gl), &fm_lingshou_gl);
         Application->CreateForm(__classid(Tfm_kucen), &fm_kucen);
         Application->CreateForm(__classid(Tfm_xiaoshou), &fm_xiaoshou);
         Application->CreateForm(__classid(Tfm_newname), &fm_newname);
         Application->CreateForm(__classid(Tfm_passwd), &fm_passwd);
         Application->CreateForm(__classid(Tfm_check), &fm_check);
         Application->CreateForm(__classid(Tfm_xiaopiao), &fm_xiaopiao);
         Application->CreateForm(__classid(Tfm_qingli), &fm_qingli);
         Application->CreateForm(__classid(Tfm_xiaoshoumx), &fm_xiaoshoumx);
         Application->Run();
        }
        catch (Exception &exception)
        {
                 Application->ShowException(&exception);
        }
        catch (...)
        {
                 try
                 {
                         throw Exception("");
                 }
                 catch (Exception &exception)
                 {
                         Application->ShowException(&exception);
                 }
        }
        return 0;
}
一下是各个嵌套小函数。。。
1:main.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#include"math.h"
#pragma hdrstop
#include <stdio.h>
#include "main.h"
#include "data.h"
#include "name_gl.h"
#include "jinhuo_gl.h"
#include "lingshou.h"
#include "kucen.h"
#include "xiaoshou.h"
#include "passwd.h"
#include "check.h"
#include "xiaopiao.h"
#include "qingli.h"
#include "xiaoshoumx.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Tfm_main *fm_main;
//-----------------------------------------------------
int danjuhao,row;;
//---------------------------------------------------------------------------
__fastcall Tfm_main::Tfm_main(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall Tfm_main::bt_nameClick(TObject *Sender)
{
    fm_name_gl->ShowModal();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_main::bt_jinhuoClick(TObject *Sender)
{
    fm_jinhuo_gl->ShowModal();  
}
//---------------------------------------------------------------------------
void __fastcall Tfm_main::FormShow(TObject *Sender)
{
    //计算单据号
    dm_data->ds_guest->Close();
    dm_data->ds_guest->CommandText="select top 1 * from xiaoshou order by danjuhao desc";
    dm_data->ds_guest->Open();
    if(dm_data->ds_guest->RecordCount<1 && (shuliang->Focused()==true || shoujia->Focused()==true || dazhe->Focused()==true))
        danjuhao=1;
    else
        danjuhao=dm_data->ds_guest->FieldByName("danjuhao")->AsInteger+1;
        dm_data->ds_guest->Close();
    row=0;
    lb->RowCount=1;
    lb->ColCount=8;
    lb->ColWidths[3]=30;
    lb->ColWidths[7]=150;
    lb->Cells[0][0]="序号";
    lb->Cells[1][0]="货号";
    lb->Cells[2][0]="货名";
    lb->Cells[3][0]="数量";
    lb->Cells[4][0]="定价";
    lb->Cells[5][0]="优惠价";
    lb->Cells[6][0]="金额";
    lb->Cells[7][0]="时间";
    danjuhaos->Text=danjuhao;
    shuliang_hj->Text="0";
    jine_hj->Text="0";
    xianfu->Text="0";
  
}
//---------------------------------------------------------------------------
void __fastcall Tfm_main::codeKeyPress(TObject *Sender, char &Key)
{
    if(Key==VK_RETURN)
        PostMessage(Handle,WM_KEYDOWN,VK_TAB,0);
}
//---------------------------------------------------------------------------
2:data.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "data.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Tdm_data *dm_data;
//---------------------------------------------------------------------------
__fastcall Tdm_data::Tdm_data(TComponent* Owner)
        : TDataModule(Owner)
{
}
//---------------------------------------------------------------------------
3:name_gl.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "name_gl.h"
#include "data.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Tfm_name_gl *fm_name_gl;
//---------------------------------------------------------------------------
__fastcall Tfm_name_gl::Tfm_name_gl(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall Tfm_name_gl::addClick(TObject *Sender)
{
    dm_data->ds_guest->Close();
    dm_data->ds_guest->CommandText="select * from name where code='"+no->Text+"'";
    dm_data->ds_guest->Open();
    if(dm_data->ds_guest->RecordCount>0)
    {
        Application->MessageBoxA("该货物代码已经存在,请重新输入","提示",MB_OK);
        no->SetFocus();
        dm_data->ds_guest->Close();
        return;
    }
    dm_data->ds_guest->Close();
    if(no->Text!="" && name->Text!="")
    {
         dm_data->ds_name_gl->Append();
         dm_data->ds_name_gl->FieldByName("code")->AsString=no->Text;
         dm_data->ds_name_gl->FieldByName("name")->AsString=name->Text;
         dm_data->ds_name_gl->Post();
         no->Text="";
         name->Text="";
         no->SetFocus();
    }
}
//---------------------------------------------------------------------------
void __fastcall Tfm_name_gl::noKeyPress(TObject *Sender, char &Key)
{
    if(Key==VK_RETURN)
        name->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_name_gl::nameKeyPress(TObject *Sender, char &Key)
{
    if(Key==VK_RETURN)
        add->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_name_gl::FormShow(TObject *Sender)
{
    Left=170;
    Top=100;
    no->Text="";
    name->Text="";
    no->SetFocus();
    dm_data->ds_name_gl->Close();
    dm_data->ds_name_gl->Open();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_name_gl::xgClick(TObject *Sender)
{
    DBEdit2->Enabled=true;
    brow->Enabled=false;
    add->Enabled=false;
    save->Enabled=true;
    cancel->Enabled=true;
    xg->Enabled=false;
}
//---------------------------------------------------------------------------
void __fastcall Tfm_name_gl::Button4Click(TObject *Sender)
{
    no->Text="";
    name->Text="";
    no->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_name_gl::saveClick(TObject *Sender)
{
    dm_data->ds_name_gl->Post();
    brow->Enabled=true;
    add->Enabled=true;
    DBEdit2->Enabled=false;
    cancel->Enabled=false;
    save->Enabled=false;
    xg->Enabled=true;
}
//---------------------------------------------------------------------------
void __fastcall Tfm_name_gl::cancelClick(TObject *Sender)
{
    dm_data->ds_name_gl->Cancel();
    brow->Enabled=true;
    add->Enabled=true;
    DBEdit2->Enabled=false;
    cancel->Enabled=false;
    save->Enabled=false;
    xg->Enabled=true;
}
//---------------------------------------------------------------------------
void __fastcall Tfm_name_gl::Button1Click(TObject *Sender)
{
    AnsiString codes;
    codes=dm_data->ds_name_gl->FieldByName("code")->AsString;
    dm_data->ds_guest->Close();
    dm_data->ds_guest->CommandText="select * from jinhuo where code='"+codes+"'";
    dm_data->ds_guest->Open();
    if(dm_data->ds_guest->RecordCount>0)
    {
        Application->MessageBoxA((codes+"的货物有进货数据,要将其进货数据先删除才可以删除货名").c_str(),"提示",MB_OK);
        dm_data->ds_guest->Close();
        return;
    }
    if(Application->MessageBoxA((DBEdit1->Text+"的进货及销售记录将全部删除").c_str(),"警告",MB_OKCANCEL)==IDOK)
        dm_data->ds_name_gl->DeleteRecords(arCurrent);
}
//---------------------------------------------------------------------------
void __fastcall Tfm_name_gl::closeClick(TObject *Sender)
{
    Close();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_name_gl::FormClose(TObject *Sender,
      TCloseAction &Action)
{
    dm_data->ds_name_gl->Close();  
}
//---------------------------------------------------------------------------
4:jinhuo_gl.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
USEFORM("main.cpp", fm_main);
USEFORM("data.cpp", dm_data); /* TDataModule: File Type */
USEFORM("name_gl.cpp", fm_name_gl);
USEFORM("jinhuo_gl.cpp", fm_jinhuo_gl);
USEFORM("lingshou.cpp", fm_lingshou_gl);
USEFORM("kucen.cpp", fm_kucen);
USEFORM("xiaoshou.cpp", fm_xiaoshou);
USEFORM("newname.cpp", fm_newname);
USEFORM("passwd.cpp", fm_passwd);
USEFORM("check.cpp", fm_check);
USEFORM("xiaopiao.cpp", fm_xiaopiao);
USEFORM("qingli.cpp", fm_qingli);
USEFORM("xiaoshoumx.cpp", fm_xiaoshoumx);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
        try
        {
                 Application->Initialize();
                 Application->CreateForm(__classid(Tfm_main), &fm_main);
         Application->CreateForm(__classid(Tdm_data), &dm_data);
         Application->CreateForm(__classid(Tfm_name_gl), &fm_name_gl);
         Application->CreateForm(__classid(Tfm_jinhuo_gl), &fm_jinhuo_gl);
         Application->CreateForm(__classid(Tfm_lingshou_gl), &fm_lingshou_gl);
         Application->CreateForm(__classid(Tfm_kucen), &fm_kucen);
         Application->CreateForm(__classid(Tfm_xiaoshou), &fm_xiaoshou);
         Application->CreateForm(__classid(Tfm_newname), &fm_newname);
         Application->CreateForm(__classid(Tfm_passwd), &fm_passwd);
         Application->CreateForm(__classid(Tfm_check), &fm_check);
         Application->CreateForm(__classid(Tfm_xiaopiao), &fm_xiaopiao);
         Application->CreateForm(__classid(Tfm_qingli), &fm_qingli);
         Application->CreateForm(__classid(Tfm_xiaoshoumx), &fm_xiaoshoumx);
         Application->Run();
        }
        catch (Exception &exception)
        {
                 Application->ShowException(&exception);
        }
        catch (...)
        {
                 try
                 {
                         throw Exception("");
                 }
                 catch (Exception &exception)
                 {
                         Application->ShowException(&exception);
                 }
        }
        return 0;
}
//---------------------------------------------------------------------------
5:lingshou.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "lingshou.h"
#include "data.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Tfm_lingshou_gl *fm_lingshou_gl;
static int danju0,shuliang0;
static float jine0;
//---------------------------------------------------------------------------
__fastcall Tfm_lingshou_gl::Tfm_lingshou_gl(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall Tfm_lingshou_gl::FormShow(TObject *Sender)
{
    Left=10;
    Top=100;
    dt->Enabled=true;
    code->Enabled=false;
    RadioButton1->Checked=true;
  
    dt->DateTime=Now();
    dt->SetFocus();
    dtChange(Sender);
}
//---------------------------------------------------------------------------
void __fastcall Tfm_lingshou_gl::dtChange(TObject *Sender)
{
    int danju1;
    dm_data->ds_xiaoshou_lb->Close();
    dm_data->ds_xiaoshou_lb->Parameters->ParamValues["dt"]=dt->Date.FormatString("yyyy-mm-dd")+" 0:0:0";
    dm_data->ds_xiaoshou_lb->Parameters->ParamValues["dt0"]=dt->Date.FormatString("yyyy-mm-dd")+" 23:59:59";
    dm_data->ds_xiaoshou_lb->Parameters->ParamValues["code"]="%";
    dm_data->ds_xiaoshou_lb->Open();
    danju0=0;
    danju1=0;
    shuliang0=0;
    jine0=0;
    dm_data->ds_xiaoshou_lb->First();
    while(!dm_data->ds_xiaoshou_lb->Eof)
    {
        if(danju1!=dm_data->ds_xiaoshou_lb->FieldByName("danjuhao")->AsInteger)
        {
            danju1=dm_data->ds_xiaoshou_lb->FieldByName("danjuhao")->AsInteger;
            danju0++;
        }
        shuliang0+=dm_data->ds_xiaoshou_lb->FieldByName("shuliang")->AsInteger;
        jine0+=dm_data->ds_xiaoshou_lb->FieldByName("jine")->AsFloat;
        dm_data->ds_xiaoshou_lb->Next();
    }
    danju->Text=IntToStr(danju0);
    shuliang->Text=IntToStr(shuliang0);
    jine->Text=FormatFloat("0.00",jine0);
}
//---------------------------------------------------------------------------
void __fastcall Tfm_lingshou_gl::Button2Click(TObject *Sender)
{
    Close();
}
//---------------------------------------------------------------------------
6:kucen.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "kucen.h"
#include "data.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Tfm_kucen *fm_kucen;
static int shoushu,censhu,jinshu;
static float shoujine,cenjine;
//---------------------------------------------------------------------------
__fastcall Tfm_kucen::Tfm_kucen(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall Tfm_kucen::FormShow(TObject *Sender)
{
    Left=50;
    Top=50;
    showjin->Checked=false;
    showjinClick(Sender);
}
//---------------------------------------------------------------------------
void __fastcall Tfm_kucen::FormClose(TObject *Sender, TCloseAction &Action)
{
    dm_data->ds_xiaoshou_hj->Close();
    dm_data->ds_jinhuo_hj->Close();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_kucen::Button1Click(TObject *Sender)
{
    Close();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_kucen::showjinClick(TObject *Sender)
{
    int i=1;
    dm_data->ds_jinhuo_hj->Close();
    dm_data->ds_jinhuo_hj->Open();
    dm_data->ds_xiaoshou_hj->Close();
    dm_data->ds_xiaoshou_hj->Parameters->ParamValues["dt0"]="1900-01-01 0:0:0";
    dm_data->ds_xiaoshou_hj->Parameters->ParamValues["dt1"]="3000-01-01 23:59:59";
    dm_data->ds_xiaoshou_hj->Open();
    lb->ColCount=9;
    lb->RowCount=2;
    lb->Cells[0][0]="序号";
    lb->Cells[1][0]="货号";
    lb->Cells[2][0]="货名";
    lb->Cells[3][0]="销售数量";
    lb->Cells[4][0]="销售金额";
    lb->Cells[5][0]="进货总数";
    lb->Cells[6][0]="库存数量";
    lb->Cells[7][0]="进货价格";
    lb->Cells[8][0]="库存金额";
    TLocateOptions opts;
    opts.Clear();
    shoushu=censhu=jinshu=0;
    shoujine=cenjine=0;
    dm_data->ds_jinhuo_hj->First();
    while(!dm_data->ds_jinhuo_hj->Eof)
    {
        if(dm_data->ds_xiaoshou_hj->Locate("code",dm_data->ds_jinhuo_hj->FieldValues["code"],opts))
        {
            lb->Cells[0][i]=IntToStr(i);
            lb->Cells[1][i]=dm_data->ds_jinhuo_hj->FieldValues["code"];
            lb->Cells[2][i]=dm_data->ds_jinhuo_hj->FieldValues["name0"];
            lb->Cells[3][i]=dm_data->ds_xiaoshou_hj->FieldValues["shuliang0"];
            lb->Cells[4][i]=dm_data->ds_xiaoshou_hj->FieldValues["jine0"];
            lb->Cells[5][i]=dm_data->ds_jinhuo_hj->FieldValues["shuliang0"];
            lb->Cells[6][i]=dm_data->ds_jinhuo_hj->FieldValues["shuliang0"]-dm_data->ds_xiaoshou_hj->FieldValues["shuliang0"];
            lb->Cells[7][i]=dm_data->ds_jinhuo_hj->FieldValues["jinjia0"];
            lb->Cells[8][i]=FormatFloat("0.00",StrToFloat(lb->Cells[7][i])*StrToInt(lb->Cells[6][i]));
        }
        else
        {
            lb->Cells[0][i]=IntToStr(i);
            lb->Cells[1][i]=dm_data->ds_jinhuo_hj->FieldValues["code"];
            lb->Cells[2][i]=dm_data->ds_jinhuo_hj->FieldValues["name0"];
            lb->Cells[3][i]="0";
            lb->Cells[4][i]="0";
            lb->Cells[5][i]=dm_data->ds_jinhuo_hj->FieldValues["shuliang0"];
            lb->Cells[6][i]=dm_data->ds_jinhuo_hj->FieldValues["shuliang0"];
            lb->Cells[7][i]=dm_data->ds_jinhuo_hj->FieldValues["jinjia0"];
            lb->Cells[8][i]=FormatFloat("0.00",StrToFloat(lb->Cells[7][i])*StrToInt(lb->Cells[6][i]));
        }
        shoushu+=StrToInt(lb->Cells[3][i]);
        shoujine+=StrToFloat(lb->Cells[4][i]);
        jinshu+=StrToInt(lb->Cells[5][i]);
        censhu+=StrToInt(lb->Cells[6][i]);
        cenjine+=StrToFloat(lb->Cells[8][i]);
        dm_data->ds_jinhuo_hj->Next();
        lb->RowCount++;
        i++;
    }
    if(lb->RowCount>2)
        lb->RowCount--;
    else
        for(int j=1;j<=6;j++)
            lb->Cells[j][1]="";
    shoushus->Text=shoushu;
    jinshus->Text=jinshu;
    censhus->Text=censhu;
    shoujines->Text=FormatFloat("0.00",shoujine);
    cenjines->Text=FormatFloat("0.00",cenjine);
    if(showjin->Checked==false)
    {
        lb->ColCount=7;
        cenjines->Visible=false;
    }
    else
    {
        lb->ColCount=9;
        cenjines->Visible=true;
    }
}
//---------------------------------------------------------------------------
7:xiaoshou.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "xiaoshou.h"
#include "data.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Tfm_xiaoshou *fm_xiaoshou;\
int shuliang0;
float jine0,maoli0;
//---------------------------------------------------------------------------
__fastcall Tfm_xiaoshou::Tfm_xiaoshou(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall Tfm_xiaoshou::huizongClick(TObject *Sender)
{
    dm_data->ds_jinhuo_jia->Close();
    dm_data->ds_jinhuo_jia->Open();
    dm_data->ds_xiaoshou_hj->Close();
    dm_data->ds_xiaoshou_hj->Parameters->ParamValues["dt0"]=dt0->Date.FormatString("yyyy-mm-dd")+" 0:0:0";
    dm_data->ds_xiaoshou_hj->Parameters->ParamValues["dt1"]=dt1->Date.FormatString("yyyy-mm-dd")+" 23:59:59";
    dm_data->ds_xiaoshou_hj->Open();
    lb->ColCount=7;
    lb->RowCount=2;
    lb->Cells[0][0]="序号";
    lb->Cells[1][0]="货号";
    lb->Cells[2][0]="货名";
    lb->Cells[3][0]="销售数量";
    lb->Cells[4][0]="销售金额";
    lb->Cells[5][0]="进货价格";
    lb->Cells[6][0]="销售毛利";
    shuliang0=0;
    jine0=0;
    maoli0=0;
    int i=1;
    dm_data->ds_xiaoshou_hj->First();
    while(!dm_data->ds_xiaoshou_hj->Eof)
    {
        lb->Cells[0][i]=IntToStr(i);
        lb->Cells[1][i]=dm_data->ds_xiaoshou_hj->FieldValues["code"];
        lb->Cells[2][i]=dm_data->ds_xiaoshou_hj->FieldValues["name0"];
        lb->Cells[3][i]=dm_data->ds_xiaoshou_hj->FieldValues["shuliang0"];
        lb->Cells[4][i]=dm_data->ds_xiaoshou_hj->FieldValues["jine0"];
        lb->Cells[5][i]=dm_data->ds_jinhuo_jia->FieldValues["jinjia0"];
        lb->Cells[6][i]=FormatFloat("0.00",StrToFloat(lb->Cells[4][i])-StrToFloat(lb->Cells[5][i])*StrToInt(lb->Cells[3][i]));
        shuliang0+=StrToInt(lb->Cells[3][i]);
        jine0+=StrToFloat(lb->Cells[4][i]);
        maoli0+=StrToFloat(lb->Cells[6][i]);
        dm_data->ds_xiaoshou_hj->Next();
        lb->RowCount++;
        i++;
    }
    if(lb->RowCount>2)
        lb->RowCount--;
    else
        for(int j=1;j<=6;j++)
            lb->Cells[j][1]="";
    shuliang->Text=shuliang0;
    jine->Text=FormatFloat("0.00",jine0);
    maoli->Text=FormatFloat("0.00",maoli0);
}
//---------------------------------------------------------------------------
void __fastcall Tfm_xiaoshou::FormShow(TObject *Sender)
{
    Left=100;
    Top=80;
    dt0->DateTime=Now();
    dt1->DateTime=Now();
    dt0->SetFocus();
    huizongClick(Sender);
}
//---------------------------------------------------------------------------
void __fastcall Tfm_xiaoshou::Button2Click(TObject *Sender)
{
    Close();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_xiaoshou::FormClose(TObject *Sender,
      TCloseAction &Action)
{
    dm_data->ds_xiaoshou_hj->Close();
    dm_data->ds_jinhuo_jia->Close();
}
//---------------------------------------------------------------------------
8:newname.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "newname.h"
#include "data.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Tfm_newname *fm_newname;
AnsiString newcode,newname;
//---------------------------------------------------------------------------
__fastcall Tfm_newname::Tfm_newname(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall Tfm_newname::Button1Click(TObject *Sender)
{
    newname=name->Text;
    dm_data->ds_name_gl->Close();
    dm_data->ds_name_gl->Open();
    dm_data->ds_name_gl->Append();
    dm_data->ds_name_gl->FieldByName("code")->AsString=newcode;
    dm_data->ds_name_gl->FieldByName("name")->AsString=newname;
    dm_data->ds_name_gl->Post();
    dm_data->ds_name_gl->Close();
    Close();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_newname::Button2Click(TObject *Sender)
{
    newname="";
    Close();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_newname::FormShow(TObject *Sender)
{
    name->SetFocus();
    code->Text=newcode;
}
//---------------------------------------------------------------------------
void __fastcall Tfm_newname::nameKeyPress(TObject *Sender, char &Key)
{
    if(Key==VK_RETURN)
        PostMessage(Handle,WM_KEYDOWN,VK_TAB,0);
}
//---------------------------------------------------------------------------
9:passwd.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "passwd.h"
#include "data.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Tfm_passwd *fm_passwd;
//---------------------------------------------------------------------------
__fastcall Tfm_passwd::Tfm_passwd(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall Tfm_passwd::FormShow(TObject *Sender)
{
    Left=200;
    Top=200;
    dm_data->ds_passwd->Close();
    dm_data->ds_passwd->Open();
    pass1->Text="";
    pass2->Text="";
}
//---------------------------------------------------------------------------
void __fastcall Tfm_passwd::pass1Exit(TObject *Sender)
{
    pass2->Text="";
}
//---------------------------------------------------------------------------
void __fastcall Tfm_passwd::pass2Exit(TObject *Sender)
{
    if(pass1->Text!=pass2->Text)
    {
        Application->MessageBoxA("两次输入的密码不一致,请重新输入","提示",MB_OK);
        pass1->Text="";
        pass2->Text="";
        pass1->SetFocus();
    }
}
//---------------------------------------------------------------------------
void __fastcall Tfm_passwd::Button1Click(TObject *Sender)
{
    if(pass1->Text=="" || pass2->Text=="")
    {
        Application->MessageBoxA("密码不能为空,请重新输入","提示",MB_OK);
        pass1->Text="";
        pass2->Text="";
        pass1->SetFocus();
        return;
    }
    dm_data->ds_passwd->Edit();
    dm_data->ds_passwd->FieldByName("code")->AsString=pass1->Text;
    dm_data->ds_passwd->Post();
    dm_data->ds_passwd->Close();
    Close();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_passwd::Button2Click(TObject *Sender)
{
    dm_data->ds_passwd->Close();
    Close();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_passwd::Button3Click(TObject *Sender)
{
    Close();  
}
//---------------------------------------------------------------------------
void __fastcall Tfm_passwd::FormClose(TObject *Sender,
      TCloseAction &Action)
{
    dm_data->ds_passwd->Close();  
}
//---------------------------------------------------------------------------
10:check.cpp"
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "check.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Tfm_check *fm_check;
AnsiString passwd;
//---------------------------------------------------------------------------
__fastcall Tfm_check::Tfm_check(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall Tfm_check::FormShow(TObject *Sender)
{
    pass->Text="";
    pass->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_check::Button1Click(TObject *Sender)
{
    passwd=pass->Text;
    Close();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_check::Button2Click(TObject *Sender)
{
    passwd="";
    Close();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_check::passKeyPress(TObject *Sender, char &Key)
{
    if(Key==VK_RETURN)
        PostMessage(Handle,WM_KEYDOWN,VK_TAB,0);
  
}
//---------------------------------------------------------------------------
11:xiaopiao.cpp"
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "xiaopiao.h"
#include "data.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Tfm_xiaopiao *fm_xiaopiao;
//---------------------------------------------------------------------------
__fastcall Tfm_xiaopiao::Tfm_xiaopiao(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall Tfm_xiaopiao::FormShow(TObject *Sender)
{
    Left=100;
    Top=100;
    dm_data->ds_xiaopiao->Close();
    dm_data->ds_xiaopiao->Open();
    dm_data->ds_xiaopiao->Edit();
    dm_data->ds_guest->Close();
    dm_data->ds_guest->CommandText="select * from code where id=20000";
    dm_data->ds_guest->Open();
    piaotou->Text=dm_data->ds_guest->FieldByName("content")->AsString;
    dm_data->ds_guest->Close();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_xiaopiao::FormClose(TObject *Sender,
      TCloseAction &Action)
{
    dm_data->ds_xiaopiao->Edit();
    dm_data->ds_xiaopiao->Post();
    dm_data->ds_xiaopiao->Close();
    dm_data->ds_guest->Close();
    dm_data->ds_guest->CommandText="select * from code where id=20000";
    dm_data->ds_guest->Open();
    dm_data->ds_guest->Edit();
    dm_data->ds_guest->FieldByName("content")->AsString=piaotou->Text;
    dm_data->ds_guest->Post();
    dm_data->ds_guest->Close();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_xiaopiao::Button1Click(TObject *Sender)
{
    int id;
    dm_data->ds_xiaopiao->Last();
    id=dm_data->ds_xiaopiao->FieldByName("id")->AsInteger+1;
    if(id>=29999)
        return;
    dm_data->ds_xiaopiao->Append();
    dm_data->ds_xiaopiao->FieldByName("id")->AsInteger=id;
    dm_data->ds_xiaopiao->Post();
}
//---------------------------------------------------------------------------
void __fastcall Tfm_xiaopiao::Button2Click(TObject *Sender)
{
    if(Application->MessageBoxA("真的要删除最后一行吗?","提示",MB_OKCANCEL)==IDOK)
    {
        if(dm_data->ds_xiaopiao->RecordCount==1) return;
        dm_data->ds_xiaopiao->Last();
        dm_data->ds_xiaopiao->DeleteRecords(arCurrent);
    }
}
//---------------------------------------------------------------------------
void __fastcall Tfm_xiaopiao::Button3Click(TObject *Sender)
{
    Close();  
}
//---------------------------------------------------------------------------
12:qingli.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "qingli.h"
#include "data.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Tfm_qingli *fm_qingli;
//---------------------------------------------------------------------------
__fastcall Tfm_qingli::Tfm_qingli(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall Tfm_qingli::Button1Click(TObject *Sender)
{
    if(Application->MessageBoxA((lingshou->Caption+" 此删除不可恢复,请慎重!").c_str(),"警告",MB_OKCANCEL)==IDOK)
    {
        dm_data->cm_guest->CommandText="delete from xiaoshou";
        dm_data->cm_guest->Execute();
    }
}
//---------------------------------------------------------------------------
void __fastcall Tfm_qingli::Button2Click(TObject *Sender)
{
    if(Application->MessageBoxA((jinhuo->Caption+" 此删除不可恢复,请慎重!").c_str(),"警告",MB_OKCANCEL)==IDOK)
    {
        dm_data->cm_guest->CommandText="delete from xiaoshou";
        dm_data->cm_guest->Execute();
        dm_data->cm_guest->CommandText="delete from jinhuo";
        dm_data->cm_guest->Execute();
    }
}
//---------------------------------------------------------------------------
void __fastcall Tfm_qingli::Button3Click(TObject *Sender)
{
    if(Application->MessageBoxA((name->Caption+" 此删除不可恢复,请慎重!").c_str(),"警告",MB_OKCANCEL)==IDOK)
    {
        dm_data->cm_guest->CommandText="delete from xiaoshou";
        dm_data->cm_guest->Execute();
        dm_data->cm_guest->CommandText="delete from jinhuo";
        dm_data->cm_guest->Execute();
        dm_data->cm_guest->CommandText="delete from name";
        dm_data->cm_guest->Execute();
    }
}
//---------------------------------------------------------------------------
void __fastcall Tfm_qingli::Button4Click(TObject *Sender)
{
    Close();  
}
//---------------------------------------------------------------------------
13://---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "qr_xiaoshoumx.h"
#include "data.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Tfm_xiaoshoumx *fm_xiaoshoumx;
//---------------------------------------------------------------------------
__fastcall Tfm_xiaoshoumx::Tfm_xiaoshoumx(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall Tfm_xiaoshoumx::Button1Click(TObject *Sender)
{
    ds_xiaoshou_lb->Close();
    ds_xiaoshou_lb->Open();
    rep->Preview();
}
//---------------------------------------------------------------------------

[ 本帖最后由 redicehong 于 2009-9-1 00:01 编辑 ]
搜索更多相关主题的帖子: include 
2009-08-31 23:59
redicehong
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2009-8-31
收藏
得分:0 
这个的题目原本是:
.编制超市帐务管理程序,假设某超市试营业期间销售若干种商品(不少于10种),请根据商品名称、批发价、零售价、进货价格、进货数量、出货数量,模拟客户购物时的情景,物品名称、数量、购物日期由键盘输入,购物小票基本信息包括:小票编号、购物日期、所购商品(名称、数量、单价)、总价格。

要求:

l         

l        编写主菜单;

l        可以查询该超市商品信息;

l        用户购买完成后,输出用户购物清单(购物小票);

l        用户可以查询自己的购买记录;

l        客户退货处理程序(牵涉销售额、出货数量),这里退货需要根据购物小票编号;

l        统计试营业期间的营业额(管理员);

l        分别按销量和营业额对这些商品进行排序(管理员);

l        输出利润最高的商品和最低的商品(管理员);

l        根据库存和销售情况判断这些商品中哪些需要进货、哪些

  可能需要退货(管理员).

l        附加要求:(包括用户界面和管理员界面,用户及管理员通过ID

       和password进入,其中管理员ID为admin,

       管理员默认的password为TurboC,进入后密码都可

       以修改);

l        注:如果按附加要求完成,以上各个功能中未标“(管理员)”者,为管理员和一般用户界面中都包含的功能,标“(管理员)”

l        者为管理员界面中专有。不做附加要求则可以统一到一个界面中去。

 
如果大家觉得重编更方便的。。。我也会非常感谢的。。。
2009-09-01 00:03
redicehong
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2009-8-31
收藏
得分:0 
hongyueming89@。这是我的邮箱。。。欢迎给我留言。。。
2009-09-01 12:38
快速回复:求助:vc转tc .很难,希望有人帮助
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.038150 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved