Package clips.delegate.contract

Examples of clips.delegate.contract.ServisePriceData


                        }

                        @Override
                        public Object getValueAt(int rowIndex, int col) {
                            try {
                                ServisePriceData data = sel.get(rowIndex);
                                if (col == 0) {
                                    return data.getService().getTitle();                               
                                }
                                else if (col == 1) {
                                    return String.format("%.2f", ((float) data.getPrice()) / 100);
                                }
                                else if (col == 2) {
                                    return String.format("%.2f", ((float) data.getMoney()) / 100);
                                }
                                else {
                                    return "";
                                }
                            } catch (ClipsException ex) {
                                return new ErrorValue(ex);
                            }
                        }
                    };
                    title += ": включенные услуги";
                }
                else if (tbtPackTemplates.isSelected()) {
                    String templates = "";
                    Iterator<DirectoryPacketTemplateItem> it = contractLocal.getTemplates().iterator();
                    while (it.hasNext()) {
                        DirectoryPacketTemplateItem item = it.next();
                        templates += "   - " + item.getTitle();
                        templates += "\n";
                    }
                    data.put("packetTemplates", "Включенные пакеты услуг:\n" + templates);
                    title += ": доступные пакеты услуг";
                }
                               
                PrintCreators.createGeneratedReport(title, null, data.entrySet(), null, model, getClass());
            }
        } catch (ClipsException ex) {
            MessageBox.showException(ex);
        }
    }
View Full Code Here


        TableModelServicePrice tmsp = null;
        if (table.getModel() instanceof TableModelServicePrice){
           
            tmsp = (TableModelServicePrice) table.getModel();

            ServisePriceData servisePriceData = null;
            Pair<DirectoryServiceItem, DirectoryReceptionTypeItem> pair = tmsp.getSerRecType(row);
            render().setIcon(null);
            // Метим невведенные цены зеленым
            if (col == TableModelServicePrice.COL_PRICE) {
                if (servisePriceData != null && servisePriceData.getPrice() < 0) {
                    render().setBackground(DefaultColors.FIELD_TO_INPUT);
                }
            }
            if (col == TableModelServicePrice.COL_MONEY) {
                if (servisePriceData != null && servisePriceData.getMoney() < 0) {
                    render().setBackground(DefaultColors.FIELD_TO_INPUT);
                }
            }
            servisePriceData = contract.getContractService(pair);
            if (servisePriceData == null) {
View Full Code Here

    @Override
    public Object getValueAt(int row, int col) {
        try {           
            Pair<DirectoryServiceItem, DirectoryReceptionTypeItem> pair = serRecTypeList.get(row);
            ServisePriceData contractServiceData = contract.getContractService(pair);
            switch (col) {
                case COL_INCONTRACT:
                    return (contractServiceData != null);
                case COL_RECEPTION_TYPE:
                    return pair.second;
                case COL_SERVICE:
                    return pair.first;
                case COL_PRICE:
                    if (contractServiceData == null || contractServiceData.getPrice()<0) {
                        return "";
                    }
                    else {
                        return String.format("%.2f", ((float) contractServiceData.getPrice()) / 100);
                    }
                case COL_MONEY:
                    if (contractServiceData == null || contractServiceData.getMoney() < 0) {
                        return "";
                    } else {
                        return String.format("%.2f", ((float) contractServiceData.getMoney()) / 100);
                    }
                default: throw new IllegalArgumentException("Некорректный номер столбца : " + col);
            }
        } catch (ClipsException ex) {
            if (getColumnClass(col) == Boolean.class) {
View Full Code Here

            Pair<DirectoryServiceItem, DirectoryReceptionTypeItem> pair = serRecTypeList.get(rowIndex);
            switch (columnIndex) {
                case COL_INCONTRACT: {
                    //Добавить или удалить услугу из договора
                    if ((Boolean)value) {
                        ServisePriceData contractServiceData = contract.getContractService(pair);
                        if (contractServiceData == null) {
                            contractServiceData = new ServisePriceData(pair);
                            contract.getContractServiceList().append(contractServiceData);
                        }
                    } else {
                        contract.removeService(pair);//! о как надо
                    }
                    break;
                }
                case COL_PRICE: {
                    //Назначить другую цену услуги
                    ServisePriceData contractServiceData = contract.getContractService(pair);
                    try {
                        Number v = NumberFormat.getInstance().parse(value.toString());
                        contractServiceData.setPrice((int) (v.floatValue()*100));
                    } catch (ParseException ex) {
                        contractServiceData.setPrice(-1);
                        System.out.println("Неправильный формат числа, используем -1");
                    }
                    break;
                }
                case COL_MONEY: {
                    //Назначить другую оплату по договору услуги
                    ServisePriceData contractServiceData = contract.getContractService(pair);
                    try {
                        Number v = NumberFormat.getInstance().parse(value.toString());
                        contractServiceData.setMoney((int) (v.floatValue()*100));
                    } catch (ParseException ex) {
                        contractServiceData.setMoney(-1);
                        System.out.println("Неправильный формат числа, используем -1");
                    }
                    break;
                }
                default: throw new IllegalArgumentException("Некорректный номер столбца : " + columnIndex);
View Full Code Here

        JLabel render = render();
        TableModelPacketServices model = (TableModelPacketServices) table.getModel();
        DirectoryServiceItem service = (DirectoryServiceItem) model.getValueAt(row, TableModelPacketServices.COL_SERVICE);
        boolean founded = false;
        for (int i = 0; i < contractServiceList.size(); i++) {
            ServisePriceData servisePriceData = contractServiceList.get(i);
            if (service == servisePriceData.getService()) {
                founded = true;
                break;
            }
        }
        if (founded) {
View Full Code Here

        Selector<ServisePriceData> contractServiceList
                = contractLocal.getContractServiceList();
        HashMap<DirectoryServiceItem, Integer> servSet
                = new HashMap<DirectoryServiceItem, Integer>();
        for (int i = 0; i < contractServiceList.size(); i++) {
            ServisePriceData serviceData = contractServiceList.get(i);
            servSet.put(serviceData.getService(), serviceData.getPrice() - serviceData.getMoney());
        }
        for (DirectoryServiceItem dsi : serviceItems) {
            if (servSet.get(dsi) != 0){
                return false;
            }
View Full Code Here

        lastState = false;
        current = danger;
        servMap = new HashMap<DirectoryServiceItem, Integer>();
        Selector<ServisePriceData> contractServiceList = contractLocal.getContractServiceList();
        for (int i = 0; i < contractServiceList.size(); i++) {
            ServisePriceData data = contractServiceList.get(i);
            servMap.put(data.getService(), data.getPrice() - data.getMoney());
        }
        createServiceList(contractServiceList);

        if (xmlMap != null){
            this.xmlMap = xmlMap;
View Full Code Here

   
    public TableCellRenderProfcheckupItemList(ContractLocal contractLocal) throws ClipsException {
        Selector<ServisePriceData> contractServiceList = contractLocal.getContractServiceList();
        servSet = new HashMap<DirectoryServiceItem, Integer>();
        for (int i = 0; i < contractServiceList.size(); i++) {
            ServisePriceData serviceData = contractServiceList.get(i);
            servSet.put(serviceData.getService(), serviceData.getPrice() - serviceData.getMoney());
        }
        lightYellow = DefaultColors.middle(Color.YELLOW, Color.WHITE);
    }
View Full Code Here

            return;
        } else if (col >= TableModelSerRenList.COL_SERVICE && col <=
                TableModelSerRenList.COL_MONEY) {
            return;
        } else if (col == TableModelSerRenList.COL_PAY) {
            ServisePriceData price = serRen.getContractService();
            if (price == null && !serRen.hasReferencedSerRen()
                    && serRen.getPolisData().getContract().getType() != Contract.TYPE_OMI) {
                render().setBackground(Color.RED);
            } else {
                if (!serRen.isSerPayed()) {
View Full Code Here

  
    private void setScreenFields() throws ClipsException {
        Object s = "";
       
        labServiceName.setText(serRenLocal.getService().getTitle());
        ServisePriceData contractServiceData = serRenLocal.getContractService();

        if (contractServiceData == null) {
            return;
        }
        s = String.format("%.2f",((float)contractServiceData.getPrice())/100);
        labPrice.setText(s.toString());

        s = String.format("%.2f",((float)contractServiceData.getMoney())/100);
        labMoney.setText(s.toString());

        s = Integer.toString(serRenLocal.getCalculatedDiscount());
        labDiscount.setText(s.toString());

        s = String.format("%.2f",((float)serRenLocal.getTransactionSumm())/100);
        labTransactionSumm.setText(s.toString());

        float toPay = Math.round(contractServiceData.getLack() * (1 - (float) serRenLocal.getCalculatedDiscount() / 100));
        labToPayWithDisc.setText(String.format("%.2f", (toPay) / 100));

        float lack = toPay - serRenLocal.getTransactionSumm();
        labTheRest.setText(String.format("%.2f", (lack) / 100));
    }
View Full Code Here

TOP

Related Classes of clips.delegate.contract.ServisePriceData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.