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

📄 fwsl.cpp

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

#include <vcl.h>
#pragma hdrstop
#include "ShFwMain.h"
#include "FwSl.h"
#include "GetKhxx.h"
#include "khfwxx.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TFwSlForm *FwSlForm;
//---------------------------------------------------------------------------
__fastcall TFwSlForm::TFwSlForm(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TFwSlForm::FormCreate(TObject *Sender)
{
        DateTimePicker1->DateTime = Date();
        DateTimePicker2->DateTime = Date();
        GroupBox4->Enabled  = false;
        MainForm->ADOConnection1->Open();
        ADOQuerygzbm->Close();
        ADOTabledzqy->Open();
        ADOQueryggxx->Close();
        ADOQueryppxx->Close();
        ADOTableflxx->Open();
        if(ADOTableflxx->RecordCount > 0) {
                DBLookupComboBox2->KeyValue =  ADOTableflxx->FieldByName("flbh")->AsString;
                ADOQuerygzbm->Open();
                ADOQueryppxx->Open();
                if(ADOQueryppxx->RecordCount > 0) {
                        DBLookupComboBox3->KeyValue =  ADOQueryppxx->FieldByName("ppbh")->AsString;
                        ADOQueryggxx->Open();
                        if(  ADOQueryggxx->RecordCount > 0)
                                DBLookupComboBox4->KeyValue =  ADOQueryggxx->FieldByName("ggbh")->AsString;
                }
        }
        ADOQueryryxx->Open();
        DBLookupComboBox7->KeyValue = MainForm->MyLoginBh;
        ComboBox1->ItemIndex = 0;
}
//---------------------------------------------------------------------------

void __fastcall TFwSlForm::Button2Click(TObject *Sender)
{
        Close();        
}
//---------------------------------------------------------------------------

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

void __fastcall TFwSlForm::DBLookupComboBox2Click(TObject *Sender)
{
        if( DBLookupComboBox2->Text.Trim()=="")
                Abort();
        ADOQuerygzbm->Close();
        ADOQuerygzbm->Open();
        ADOQueryggxx->Close();
        ADOQueryppxx->Close();
        ADOQueryppxx->Open();
        if(ADOQueryppxx->RecordCount > 0) {
                DBLookupComboBox3->KeyValue =  ADOQueryppxx->FieldByName("ppbh")->AsString;
                ADOQueryggxx->Open();
                if(  ADOQueryggxx->RecordCount > 0)
                        DBLookupComboBox4->KeyValue =  ADOQueryggxx->FieldByName("ggbh")->AsString;
       } 
}
//---------------------------------------------------------------------------

void __fastcall TFwSlForm::DBLookupComboBox3Click(TObject *Sender)
{
        if( DBLookupComboBox2->Text.Trim()=="")
                Abort();
        if( DBLookupComboBox3->Text.Trim()=="")
                Abort();
        ADOQueryggxx->Close();
        ADOQueryggxx->Open();
        if(  ADOQueryggxx->RecordCount > 0)
                DBLookupComboBox4->KeyValue =  ADOQueryggxx->FieldByName("ggbh")->AsString;
}
//---------------------------------------------------------------------------


void __fastcall TFwSlForm::Button1Click(TObject *Sender)
{
        AnsiString sql,datmp;
        char tmp[100];

        if(Edit1->Text.Trim()=="") {
                Application->MessageBox("请输入客户名称","错误",MB_OK+MB_ICONERROR);
                Abort();
        }
        MainForm->AllTrim(Edit1->Text,tmp);
        Edit1->Text = String(tmp);

        if(Edit2->Text.Trim()=="" && Edit3->Text.Trim()=="" ) {
                Application->MessageBox("请输入联系方式","错误",MB_OK+MB_ICONERROR);
                Abort();
        }
        if( DBLookupComboBox1->Text.Trim()=="" ) {
                Application->MessageBox("请选择客户区域","错误",MB_OK+MB_ICONERROR);
                Abort();
        }

        if(DBLookupComboBox2->Text.Trim()=="" ) {
                Application->MessageBox("请选择商品分类","错误",MB_OK+MB_ICONERROR);
                Abort();
        }
        if(DBLookupComboBox3->Text.Trim()=="" ) {
                Application->MessageBox("请选择商品品牌","错误",MB_OK+MB_ICONERROR);
                Abort();
        }
        if(DBLookupComboBox4->Text.Trim()=="" ) {
                Application->MessageBox("请选择商品规格","错误",MB_OK+MB_ICONERROR);
                Abort();
        }
        if(RadioGroup1->ItemIndex == 1 ) {
                if( DBLookupComboBox6->Text.Trim()=="" && Edit8->Text.Trim()=="" ) {
                        Application->MessageBox("请选择和输入现象种类或客户描述","错误",MB_OK+MB_ICONERROR);
                        Abort();
                }
        }

        ADOQuerytmp->Close();
        ADOQuerytmp->SQL->Clear();
        sql = "select * from khxx where name='"+Edit1->Text.Trim()+"' and qybh='"+DBLookupComboBox1->KeyValue+"'";
        if( Edit2->Text.Trim()!="")
                sql += " or lxdh ='"+Edit2->Text.Trim()+"' or yddh='"+Edit2->Text.Trim()+"'";
        if( Edit3->Text.Trim()!="")
                sql += " or yddh ='"+Edit3->Text.Trim()+"'or lxdh='"+Edit3->Text.Trim()+"'";
        ADOQuerytmp->SQL->Add(sql);
        ADOQuerytmp->Open();
        if( ADOQuerytmp->RecordCount < 1)
                InsertKhxx();
        else if( ADOQuerytmp->RecordCount == 1)
                MainForm->MyKhBh = ADOQuerytmp->FieldByName("khbh")->AsString;
        else {
                MainForm->pzflag = false;
                MainForm->thflag = false;
                MainForm->MyKhBh = "0000000000";
                TGetKhForm *GetKhForm;
                try
                {
                        GetKhForm = new TGetKhForm(Application);
                        GetKhForm->ShowModal();
                        delete GetKhForm;
                }
                catch(...)
                {
                        delete GetKhForm;
                        Application->MessageBox("运行出现错误!","警告",MB_OK+MB_ICONWARNING);
                }
                if(MainForm->pzflag == false) {
                        ADOQuerytmp->Close();
                        Abort();
                } else {
                        if( MainForm->MyKhBh == "0000000000")
                                InsertKhxx();
                }
        }
        ADOQuerytmp->Close();
        ADOQuerytmp->SQL->Clear();
        ADOTablesys->Open();
        datmp= datmp.sprintf("%010d",ADOTablesys->FieldByName("cur_daid")->AsInteger + 1);
        ADOTablesys->Edit();
        ADOTablesys->FieldByName("cur_daid")->AsInteger = ADOTablesys->FieldByName("cur_daid")->AsInteger +1;
        ADOTablesys->Post();
        ADOTablesys->Close();
        sql = "insert into fwsl values(:P_dabh,:P_fwlx,:P_sflx,:P_slrq,:P_sltime,:P_xxbh,:P_xxmc,:P_khms,:P_slrbh,:P_slrm,:P_khbh,:P_khmc,:P_lxdh,:P_yddh,:P_qybh,";
        sql += ":P_qymc,:P_qylc,:P_dz,:P_yfwgf,:P_yfjtf,:P_gysbh,:P_isgysjs,:P_flbh,:P_flmc,:P_ppbh,:P_ppmc,:P_ggbh,:P_ggmc,:P_pzmc,:P_gmrq,:P_csbh,:P_pzno,:P_fwfs,:P_ydsmrq,:P_ydsmtime,:P_slbz,'否',NULL,'0000',NULL,'0000',NULL,NULL,'否',NULL,'否','否',NULL,NULL,NULL,NULL,NULL,:P_zxfwlx,:P_zxsflx,:P_slppbh,:P_slppmc,:P_slggbh,:P_slggmc,:P_jsfs)";
        ADOQuerytmp->SQL->Add(sql);
        ADOQuerytmp->Parameters->ParamByName("P_dabh")->Value = datmp;
        ADOQuerytmp->Parameters->ParamByName("P_fwlx")->Value = RadioGroup1->Items->Strings[RadioGroup1->ItemIndex];
        ADOQuerytmp->Parameters->ParamByName("P_sflx")->Value = RadioGroup2->Items->Strings[RadioGroup2->ItemIndex];
        ADOQuerytmp->Parameters->ParamByName("P_zxfwlx")->Value = RadioGroup1->Items->Strings[RadioGroup1->ItemIndex];
        ADOQuerytmp->Parameters->ParamByName("P_zxsflx")->Value = RadioGroup2->Items->Strings[RadioGroup2->ItemIndex];
        ADOQuerytmp->Parameters->ParamByName("P_slrq")->Value = Date();
        ADOQuerytmp->Parameters->ParamByName("P_sltime")->Value = FormatDateTime("hh:mm:ss",Time());
        if(DBLookupComboBox6->Text.Trim()!="") {
                ADOQuerytmp->Parameters->ParamByName("P_xxbh")->Value = DBLookupComboBox6->KeyValue;
                ADOQuerytmp->Parameters->ParamByName("P_xxmc")->Value = DBLookupComboBox6->Text;
        }else {
                ADOQuerytmp->Parameters->ParamByName("P_xxbh")->Value = "0000";
                ADOQuerytmp->Parameters->ParamByName("P_xxmc")->Value = "";
        }
        ADOQuerytmp->Parameters->ParamByName("P_khms")->Value = Edit8->Text;
        ADOQuerytmp->Parameters->ParamByName("P_slrbh")->Value = DBLookupComboBox7->KeyValue;
        ADOQuerytmp->Parameters->ParamByName("P_slrm")->Value = DBLookupComboBox7->Text;
        ADOQuerytmp->Parameters->ParamByName("P_khbh")->Value = MainForm->MyKhBh;
        ADOQuerytmp->Parameters->ParamByName("P_khmc")->Value = Edit1->Text;
        ADOQuerytmp->Parameters->ParamByName("P_lxdh")->Value = Edit2->Text;
        ADOQuerytmp->Parameters->ParamByName("P_yddh")->Value = Edit3->Text;
        ADOQuerytmp->Parameters->ParamByName("P_qybh")->Value = DBLookupComboBox1->KeyValue;
        ADOQuerytmp->Parameters->ParamByName("P_qymc")->Value = DBLookupComboBox1->Text;
        ADOQuerytmp->Parameters->ParamByName("P_qylc")->Value = ADOTabledzqy->FieldByName("lc")->AsInteger;
        if(RadioButton2->Checked == true ) {

⌨️ 快捷键说明

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