⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ggset.cpp

📁 售后服务系统优质的售后服务是企业生存和市场竞争的保障
💻 CPP
📖 第 1 页 / 共 2 页
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop
#include "ShFwMain.h"
#include "GgSet.h"
#include "WxBwFySet.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TGgSetForm *GgSetForm;
//---------------------------------------------------------------------------
__fastcall TGgSetForm::TGgSetForm(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------



void __fastcall TGgSetForm::FormCreate(TObject *Sender)
{
        ADOTablegysxx->Open();
        GroupBox1->Enabled = true;
        GroupBox5->Enabled = false;
        GroupBox6->Enabled = false;
        Button4->Enabled = false;
        Button6->Enabled = false;
        Button5->Enabled = false;

        Button8->Enabled = false;
        Button9->Enabled = false;
        Button10->Enabled = false;
        Button11->Enabled = false;
        Button12->Enabled = false;
        
        ADOQueryggxx->Close();
        ADOQueryppxx->Close();
        ADOTableflxx->Close();
        ADOTableflxx->Open();
}
//---------------------------------------------------------------------------

void __fastcall TGgSetForm::FormClose(TObject *Sender,
      TCloseAction &Action)
{
        ADOTablegysxx->Close();  
}
//---------------------------------------------------------------------------

void __fastcall TGgSetForm::Button7Click(TObject *Sender)
{
        Close();
}
//---------------------------------------------------------------------------

void __fastcall TGgSetForm::Button3Click(TObject *Sender)
{
        if(DBLookupComboBox2->Text.Trim()=="") {
                Application->MessageBox("请选择分类","错误",MB_OK+MB_ICONERROR);
                Abort();
        }
        if(DBLookupComboBox3->Text.Trim()=="") {
                Application->MessageBox("请选择品牌","错误",MB_OK+MB_ICONERROR);
                Abort();
        }
        ADOQueryggxx->Close();
        ADOQueryggxx->Open();
        ADOQueryqtfy->Close();
        ADOQueryqtfy->Open();
}
//---------------------------------------------------------------------------

void __fastcall TGgSetForm::DBLookupComboBox2Click(TObject *Sender)
{
        ADOQueryqtfy->Close();
        ADOQueryggxx->Close();
        ADOQueryppxx->Close();
        ADOQueryppxx->Open();
        if( ADOQueryppxx->RecordCount > 0) {
                DBLookupComboBox3->KeyValue = ADOQueryppxx->FieldByName("ppbh")->AsString;
                ADOQueryggxx->Open();
                if( ADOQueryggxx->RecordCount > 0)
                        ADOQueryqtfy->Open();
        }
}
//---------------------------------------------------------------------------

void __fastcall TGgSetForm::Button4Click(TObject *Sender)
{
        if(MainForm->setqx!="有") {
                Application->MessageBox("对不起!你无权设置信息!","错误",MB_OK+MB_ICONERROR);
                        Abort();
        }
        ADOQueryggxx->Insert();
        ADOQueryggxx->FieldByName("fwfyflag")->AsString ="是";
        ADOQueryggxx->FieldByName("wxsflx")->AsString ="计件";
        GroupBox1->Enabled = false;
        GroupBox5->Enabled = true;
        GroupBox6->Enabled = false;
}
//---------------------------------------------------------------------------

void __fastcall TGgSetForm::Button6Click(TObject *Sender)
{
        if(MainForm->setqx!="有") {
                Application->MessageBox("对不起!你无权设置信息!","错误",MB_OK+MB_ICONERROR);
                        Abort();
        }
        ADOQueryggxx->Edit();
        GroupBox1->Enabled = false;
        GroupBox5->Enabled = true;
        GroupBox6->Enabled = false;
}
//---------------------------------------------------------------------------

void __fastcall TGgSetForm::Button1Click(TObject *Sender)
{
        if(ADOQueryggxx->State == dsInsert ) {
                ADOQueryggxx->FieldByName("flbh")->AsString = DBLookupComboBox2->KeyValue;
                ADOQueryggxx->FieldByName("ppbh")->AsString = DBLookupComboBox3->KeyValue;
                ADOQuerytmp->Close();
                ADOQuerytmp->SQL->Clear();
                ADOQuerytmp->SQL->Add( "select max(ggbh) from ggxx where flbh='"+DBLookupComboBox2->KeyValue+"' and ppbh='"+DBLookupComboBox3->KeyValue+"'");
                ADOQuerytmp->Open();
                if(ADOQuerytmp->Fields->Fields[0]->AsString.Trim()=="")
                        ADOQueryggxx->FieldByName("ggbh")->AsString = "0001";
                else
                        ADOQueryggxx->FieldByName("ggbh")->AsString = ADOQueryggxx->FieldByName("ggbh")->AsString.sprintf("%04d",ADOQuerytmp->Fields->Fields[0]->AsString.ToInt()+1);
                ADOQuerytmp->Close();
        }
        ADOQueryggxx->Post();
        GroupBox1->Enabled = true;
        GroupBox5->Enabled = false;
}
//---------------------------------------------------------------------------

void __fastcall TGgSetForm::Button2Click(TObject *Sender)
{
        ADOQueryggxx->Cancel();
        GroupBox1->Enabled = true;
        GroupBox5->Enabled = false;
}
//---------------------------------------------------------------------------

void __fastcall TGgSetForm::ADOQueryggxxBeforePost(TDataSet *DataSet)
{
        if(DBEdit1->Text.Trim()=="") {
                Application->MessageBox("请输入规格","错误",MB_OK+MB_ICONERROR);
                Abort();
        }
        if(DBLookupComboBox1->Text.Trim()=="") {
                Application->MessageBox("请选择供应商","错误",MB_OK+MB_ICONERROR);
                Abort();
        }
        ADOQueryggxx->FieldByName("gysmc")->AsString = DBLookupComboBox1->Text;
        if(DBEdit2->Text.Trim()=="")
                ADOQueryggxx->FieldByName("anzdj")->AsFloat = 0;
        if(DBEdit3->Text.Trim()=="")
                ADOQueryggxx->FieldByName("wxdj")->AsFloat = 0;
        if(DBEdit14->Text.Trim()=="")
                ADOQueryggxx->FieldByName("smwxdj")->AsFloat = 0;
        if(DBEdit4->Text.Trim()=="")
                ADOQueryggxx->FieldByName("tsdj")->AsFloat = 0;
        if(DBEdit12->Text.Trim()=="")
                ADOQueryggxx->FieldByName("hfdj")->AsFloat = 0;
        if(DBEdit8->Text.Trim()=="")
                ADOQueryggxx->FieldByName("ryanzdj")->AsFloat = 0;
        if(DBEdit9->Text.Trim()=="")
                ADOQueryggxx->FieldByName("rywxdj")->AsFloat = 0;
        if(DBEdit10->Text.Trim()=="")
                ADOQueryggxx->FieldByName("rytsdj")->AsFloat = 0;
        if(DBEdit13->Text.Trim()=="")
                ADOQueryggxx->FieldByName("ryhfdj")->AsFloat = 0;
        if(DBEdit5->Text.Trim()=="")
                ADOQueryggxx->FieldByName("zfanzdj")->AsFloat = 0;
        if(DBEdit6->Text.Trim()=="")
                ADOQueryggxx->FieldByName("zfwxdj")->AsFloat = 0;
        if(DBEdit7->Text.Trim()=="")
                ADOQueryggxx->FieldByName("zftsdj")->AsFloat = 0;
}
//---------------------------------------------------------------------------

void __fastcall TGgSetForm::Button5Click(TObject *Sender)
{
        if(MainForm->setqx!="有") {
                Application->MessageBox("对不起!你无权设置信息!","错误",MB_OK+MB_ICONERROR);
                        Abort();
        }
        if(Application->MessageBox("是否删除当前记录?","确认",MB_OKCANCEL+MB_ICONERROR)!=IDOK)
                Abort();
        if(Application->MessageBox("相应的误工费和交通费记录也将删除,请再确认是否删除当前记录?","确认",MB_OKCANCEL+MB_ICONERROR)!=IDOK)
                Abort();
        ADOQuerytmp->Close();
        ADOQuerytmp->SQL->Clear();
        ADOQuerytmp->SQL->Add("select count(*) from fwsl where flbh='"+DBLookupComboBox2->KeyValue+"' and ppbh='"+DBLookupComboBox3->KeyValue+"' and ggbh='"+ADOQueryggxx->FieldByName("ggbh")->AsString+"'");
        ADOQuerytmp->Open();
        if(ADOQuerytmp->Fields->Fields[0]->AsInteger > 0) {
                ADOQuerytmp->Close();
                Application->MessageBox("发现FWSL相关的服务记录,为了保护档案的完整,你不能删除此记录","错误",MB_OK+MB_ICONERROR);
                Abort();
        }
        ADOQuerytmp->Close();
        ADOQuerytmp->SQL->Clear();
        ADOQuerytmp->SQL->Add("delete from gysqtfyxx where flbh='"+DBLookupComboBox2->KeyValue+"' and ppbh='"+DBLookupComboBox3->KeyValue+"' and ggbh='"+ADOQueryggxx->FieldByName("ggbh")->AsString+"'");
        ADOQuerytmp->ExecSQL();

        ADOQuerytmp->Close();
        ADOQuerytmp->SQL->Clear();
        ADOQuerytmp->SQL->Add("delete from wxbwfyxx where flbh='"+DBLookupComboBox2->KeyValue+"' and ppbh='"+DBLookupComboBox3->KeyValue+"' and ggbh='"+ADOQueryggxx->FieldByName("ggbh")->AsString+"'");
        ADOQuerytmp->ExecSQL();
        ADOQuerytmp->Close();

        ADOQueryggxx->Delete();
        ADOQueryqtfy->Close();
        ADOQueryggxx->Close();
        ADOQueryggxx->Open();
        if( ADOQueryggxx->RecordCount > 0)
                ADOQueryqtfy->Open();
}
//---------------------------------------------------------------------------

void __fastcall TGgSetForm::DataSource4StateChange(TObject *Sender)
{
        switch(ADOQueryggxx->State) {
        case dsBrowse:
                Button4->Enabled = true;
                if( ADOQueryggxx->RecordCount>0){
                        Button6->Enabled = true;
                        Button5->Enabled = true;
                        if( ADOQueryggxx->FieldByName("wxsflx")->AsString == "部位")
                                Button13->Enabled = true;
                        else
                                Button13->Enabled = false;
                } else {
                        Button6->Enabled = false;
                        Button5->Enabled = false;
                        Button13->Enabled = false;
                }
                GroupBox5->Enabled = false;
                break;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -