Exemplo n.º 1
0
        public Frm_QLCD()
        {
            // Oracle database
            _ora = new CLS_DBASE.ORA(GlobalVar.gl_connTKTQ);

            // SAP
            v_DestConfig = new InMemoryDestinationConfiguration();
            RfcDestinationManager.RegisterDestinationConfiguration(v_DestConfig);

            // Modify by ManhTV3 on 3/5/2012
            arr_dr = new ArrayList();
            // Modify by ManhTV3 on 17/5/2012
            arr_index = new ArrayList();

            //string _query = null;
            //_query += "select max(Decode(rv_key,'SID', rv_chr)) SID,";
            //_query += "max(Decode(rv_key,'USER', rv_chr)) USR,";
            //_query += "max(Decode(rv_key,'PASS', rv_chr)) PASS,";
            //_query += "max(Decode(rv_key,'LANG', rv_chr)) LANG,";
            //_query += "max(Decode(rv_key,'CLIENT', rv_chr)) CLIENT,";
            //_query += "max(Decode(rv_key,'IP', rv_chr)) IP,";
            //_query += "max(Decode(rv_key,'INUM', rv_chr)) INUM ";
            //_query += "from tb_01_para where rv_group='SER_SAP_APP'";

            //DataTable _dt = _ora.exeQuery(_query);
            //v_DestConfig.AddOrEditDestination(_dt.Rows[0]["SID"].ToString(),
            //                                          100,
            //                                          _dt.Rows[0]["USR"].ToString(),
            //                                          _dt.Rows[0]["PASS"].ToString(),
            //                                          _dt.Rows[0]["LANG"].ToString(),
            //                                          _dt.Rows[0]["CLIENT"].ToString(),
            //                                          _dt.Rows[0]["IP"].ToString(),
            //                                          _dt.Rows[0]["INUM"].ToString());

            //v_sap = RfcDestinationManager.GetDestination(_dt.Rows[0]["SID"].ToString());

            InitializeComponent();

            // Khởi tạo giá trị cho các biến thành viên
            Prc_InitializeMember();
        }
Exemplo n.º 2
0
        private void Prc_thuc_hien()
        {
            if (this.tabPage1_comboBox1.InvokeRequired)
            {
                // Khai báo delegate
                prc_thuc_hien_delegate del = new prc_thuc_hien_delegate(Prc_thuc_hien);
                this.tabPage1_comboBox1.Invoke(del);
            }
            else
            {
                ArrayList _rowIndex = new ArrayList();
                for (int i = 0; i < this.dgrTaxOffice.SelectedCells.Count; i++)
                {
                    if (_rowIndex.Contains(this.dgrTaxOffice.SelectedCells[i].RowIndex) == false)
                        _rowIndex.Add(this.dgrTaxOffice.SelectedCells[i].RowIndex);
                }

                foreach(object _obj in _rowIndex)
                {
                    try
                    {
                        // Biến lưu trữ row index của CQT
                        int _index = (int)_obj;
                        // Biến lưu tên viết tắt của CQT
                        string _short_name
                            = this.dgrTaxOffice.Rows[_index].Cells["cl_short_name"].Value.ToString().Trim();
                        // Biến lưu trữ tên của CQT
                        string _tax_name
                            = this.dgrTaxOffice.Rows[_index].Cells["cl_tax_name"].Value.ToString().Trim();
                        // Biến lưu loại hình của CQT
                        string _tax_model
                            = this.dgrTaxOffice.Rows[_index].Cells["cl_tax_model"].Value.ToString().Trim();

                        AddToListView(2, _tax_name);
                        try
                        {
                            #region Môi trường
                            if (this.ckb_ktao.Checked)
                            {
                                // Khởi tạo môi trường
                                khoiTaoMoiTruong(_index, _short_name);
                            }
                            else if (this.ckb_ddep.Checked)
                            {
                                // Dọn dẹp môi trường
                                donDepMoiTruong(_index, _short_name);
                            }
                            #endregion

                            #region Tổng hợp dữ liệu nợ, phát sinh, tờ khai 10
                            if (this.tabPage1_comboBox1.SelectedValue.ToString() == "TH")
                            {
                                // Cục thuế
                                if (_tax_model == "QLT")
                                {
                                    // Tổng hợp dữ liệu phát sinh
                                    if (this.ckb_qlt_ps.Checked)
                                        TKTQ_PCK_ORA.Prc_QLT_QltPs(_short_name);
                                    // Tổng hợp dữ liệu nợ
                                    if (this.ckb_qlt_no.Checked)
                                        TKTQ_PCK_ORA.Prc_QLT_QltNo(_short_name);
                                }
                                // Chi cục thuế
                                else if (_tax_model == "QCT")
                                {                        //
                                    if (this.ckb_qlt_ps.Checked)
                                        TKTQ_PCK_ORA.Prc_QCT_QltPs(_short_name);

                                    if (this.ckb_qlt_no.Checked)
                                        TKTQ_PCK_ORA.Prc_QCT_QltNo(_short_name);

                                    if (this.ckb_qct_ps.Checked)
                                        TKTQ_PCK_ORA.Prc_QCT_QctPs(_short_name);

                                    if (this.ckb_qct_no.Checked)
                                        TKTQ_PCK_ORA.Prc_QCT_QctNo(_short_name);

                                    if (this.ckb_qct_tk.Checked)
                                        TKTQ_PCK_ORA.Prc_QCT_QctTk(_short_name);
                                }
                            }
                            #endregion

                            #region Chuyển dữ liệu tổng hợp về database DPPIT
                            else if (this.tabPage1_comboBox1.SelectedValue.ToString() == "CV")
                            {
                                if (this.ckb_qlt_ps.Checked)
                                    TKTQ_PCK_ORA.Prc_QCT_GetQltPs(_short_name);

                                if (this.ckb_qlt_no.Checked)
                                    TKTQ_PCK_ORA.Prc_QCT_GetQltNo(_short_name);

                                if (this.ckb_qct_ps.Checked)
                                    TKTQ_PCK_ORA.Prc_QCT_GetQctPs(_short_name);

                                if (this.ckb_qct_no.Checked)
                                    TKTQ_PCK_ORA.Prc_QCT_GetQctNo(_short_name);

                                if (this.ckb_qct_tk.Checked)
                                    TKTQ_PCK_ORA.Prc_QCT_GetQctTk(_short_name);

                                if (this.ckb_error.Checked)
                                    TKTQ_PCK_ORA.Prc_QLTQCT_GetLog(_short_name);
                            }
                            #endregion

                            #region Kiểm tra dữ liệu nợ, phát sinh, tờ khai khoán 10
                            else
                            {
                                // SAP Connection
                                InMemoryDestinationConfiguration v_DestConfig = new InMemoryDestinationConfiguration();
                                try
                                {
                                    RfcDestinationManager.RegisterDestinationConfiguration(v_DestConfig);
                                    v_DestConfig.AddOrEditDestination("DE1", 1, "thanhnh5", "12345a@", "EN", "280", "10.15.119.18", "23");
                                    RfcDestination v_sap = RfcDestinationManager.GetDestination("DE1");

                                    // Kiểm tra dữ liệu nợ
                                    if (this.ckb_no.Checked)
                                    {
                                        AddToListView(2, "   + Kiểm tra dữ liệu nợ");
                                        this.Prc_ktra_du_lieu(_short_name, v_sap, "TB_NO");
                                    }

                                    // Kiểm tra dữ liệu phát sinh
                                    if (this.ckb_ps.Checked)
                                    {
                                        AddToListView(2, "   + Kiểm tra dữ liệu phát sinh");
                                        this.Prc_ktra_du_lieu(_short_name, v_sap, "TB_PS");
                                    }

                                    // Kiểm tra dữ liệu tờ khai 10
                                    if (this.ckb_tk.Checked)
                                    {
                                        AddToListView(2, "   + Kiểm tra dữ liệu phát sinh");
                                        this.Prc_ktra_du_lieu(_short_name, v_sap, "TB_TK");
                                    }
                                }
                                catch (Exception e)
                                {
                                    AddToListView(0, "   + " + e.Message);
                                }
                                finally
                                {
                                    // Ngắt kết nối tới hệ thống SAP
                                    RfcDestinationManager.UnregisterDestinationConfiguration(v_DestConfig);
                                    v_DestConfig.RemoveDestination("DE1");
                                }
                            }
                            #endregion
                        }

                        catch (InvalidOperationException e)
                        {
                            AddToListView(0, "   + " + e.Message.ToString());
                        }
                        catch (Exception e)
                        {
                            AddToListView(0, "   + " + e.Message.ToString());
                        }
                    }
                    catch (FormatException e)
                    {
                        AddToListView(0, e.Message);
                    }
                    catch (Exception e)
                    {
                        AddToListView(0, e.Message);
                    }

                }
            }
        }